Hi Jeffrey,
to access a JavaScript variable from the Iframe use the DOM window from
the Iframe. To get the window use this:
var domWindow = this.iframe.getWindow();
Now you can access your variable like this:
domWindow.variableName
But please attend that in some Browsers like IE the "load" event
arrived, but the JavaScript is not completely initialized. I couldn't
fix the issue with Fabian, so check the existence from the variable
first. If the variable doesn't exist, try the access with a timer later.
Have a look in the inspector (Application.js method: "__checkWorking")
there is done the access with a timer.
Cheers,
Chris
Jeffrey Onken schrieb:
>
> qooxdoo experts,
>
> I have a qx.ui.embed.Iframe object in my Standalone application that
> is successfully loading an HTML/JS page. It works like a charm. After
> the “load” event from that Iframe, I have access to a div element
> inside the HTML using the following command in my Application:
>
> htmlDiv = this.iframe.getDocument().getElementById(“divName”);
>
> I know that is working correctly. What I need to do, however, is
> access a JavaScript variable in that HTML page. The HTML looks like this:
>
> <body>
>
> <div id="chartDiv" style="width:800px; height:335px;">
>
> <script type="text/javascript">
>
> var chart = new Chart("chartDiv ");
>
> </script></div></body>
>
> I found this previous discussion,
> http://www.nabble.com/qooxdoo-to-Iframe-source-communication-td20343437.html,
> but it deals with a named HTML tag/DOM element, not a JavaScript
> variable. Nevertheless, I tried two ways in my Application of getting
> that variable, similar to the solution in that discussion.
>
> iframe.getDocument().variableName;
>
> htmlDiv.variableName;
>
> (recall “htmlDiv” was successfully retrieved with the command above).
> Neither worked; both resulted in no browser errors, but an “undefined”
> coming up in the qooxdoo log. I tried just acting like it’s a global
> variable with no scope/context, but that gives me an error in the
> browser error console “variableName is not defined.” I’m not sure what
> else to try to get access to that JavaScript variable.
>
> I appreciate any help you can offer. Thanks for reading.
>
> Jeff
>
> [email protected]
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel