Is Session in iFrame?

  1. 3 months ago

    Brock N

    Aug 6 Pre-Release Testers, Xojo Pro

    Just wondering if someone new the quickest/easiest way to tell if a WebSession is running in an iFrame. I want to change some behavior if so

  2. Michel B

    Aug 7 Pre-Release Testers, Xojo Pro

    This discussion seems to point to possible solutions:
    https://stackoverflow.com/questions/3420004/access-parent-url-from-iframe#7739035

    The idea to get window.parent.location seems fit. If it returns null, you know the app is not running in an iframe.

  3. Brock N

    Aug 7 Pre-Release Testers, Xojo Pro

    The best answer I've found so far is this:

    https://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t

    function inIframe () {
        try {
            return window.self !== window.top;
        } catch (e) {
            return true;
        }
    }

    But I'll have to hook it into WebControlWrapper EventListener object

  4. Tim P

    Aug 7 Pre-Release Testers Rochester, NY
    Edited 3 months ago

    It can be done within the framework as well. Check out http://docs.xojo.com/WebApplication.Security to set iframe settings.

    Edit: It doesn't look like there's a "force top" setting though. Maybe a feature request for Web 2?

  5. Brock N

    Aug 7 Pre-Release Testers, Xojo Pro

    @Tim P But I'll have to hook it into WebControlWrapper EventListener object

    Yup, I already had the app configured to allow iFraming but just wasn't sure if there was a quick framework way to tell on the session. Doesn't appear to be so, but definitely would be a nice feature. Looks like the hackaround ExecuteJavascript WebControlWrapper way is the solution for now.

or Sign Up to reply!