« Return to Thread: Iframe source change

Re: Iframe source change

by patkar_n001 :: Rate this Message:

Reply to Author | View in Thread

Thanks a lot Matt and Jonathan.

"window.parent.qx.core.Init.getApplication().getMyFrame()"
this didn't work as it was returning a NULL, for reasons unknown, even though we had function getMyFrame in application.js returning this.viewer.__iframe


So instead of getting the iframe, we implemented setSource in viewer class (derived from container) and get viewer in application.js. And this works.

Now application.js has
        getViewer : function()
        {
            return this.viewer;
        }

login.js has,
       verify: function()
       {
                var viewer = window.parent.qx.core.Init.getApplication().getViewer();
                viewer.setSource("myapplication/home.html");
       }

and viewer.js has
    setSource : function(text)
        {
                his.__iframe.setSource(text);
        },

Let me know, if there is any other better method.

Thanks & Regards
Narasimha

Matthew Gregory wrote:
OK, I think there is a helper function in qx to get the parent window
but I couldn't find it.
Your might be able to get away with something like:

window.parent.qx.core.Init.getApplication().getMyFrame()

But I am not completely sure, if you have a good inspector check the dom
properties around your iFrame until you get a reference to the parent's qx.

Perhpas somebody else knows of a qx way to do this?

patkar_n001 wrote:
> Thanks a lot for quick resolution Matt.
>
> But the problem here is, I have main application which has a container class
> for buttons and headers etc.
> And this container has iframe. And I am loading different smaller
> applications in this iframe. The design is similar to demoBrowser
> application.
>
> Application.js extends qx.application.Standalone, container class extends
> qx.ui.container.Composite and Login page extends  qx.application.Standalone.
>
> Now under these circumstances, when I do qx.core.Init.getApplication() I get
> Login page's handler and not application.js's handler. Thats why I do not
> get the iframe.
>
>
> Can you please help in this regard.
>
> Thanks & Regards
> Narasimha
>
>
>
> Matthew Gregory wrote:
>> Hi patkar,
>> I think I understand your question and it is easy to answer :)
>>
>> In application.js add a function like this:
>>
>> getMyFrame : function()
>> {
>>    return this.__iframe;
>> }
>>
>>
>> then from login.js you can access the iframe by doing this:
>>
>> qx.core.Init.getApplication().getMyFrame()
>>
>> HTH,
>> Matt
>>
>> patkar_n001 wrote:
>>> Hello,
>>>
>>> I have a main application window split into two panes. The bottom pane
>>> has a
>>> embed IFrame.
>>> >From a html source opened in the iFrame window i want to change the
> source
>>> of the iframe to another html source on a button click event.
>>>
>>> For example: In the main application.js I have
>>> +++++++++++++++++++++++++++++++++++++++++
>>> this.__iframe.setSource("myapplication/login.html");
>>> +++++++++++++++++++++++++++++++++++++++++
>>>
>>> on a button click in login.js, I need to set the Iframe source to another
>>> html (home.html).
>>> Since Iframe object, which is created in application.js, is not available
>>> in
>>> login.js I am not able to
>>> do the following,
>>> ++++++++++++++++++++++++++++++++++
>>> iframe.setSource("myapplication/home.html");
>>> ++++++++++++++++++++++++++++++++++
>>>
>>> Can you please let me know how this can be achieved.
>>>
>>> Warm regards,
>>> Narasimha
>>>
>>
>> ------------------------------------------------------------------------------
>> Enter the BlackBerry Developer Challenge  
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full
>> prize  
>> details at: http://p.sf.net/sfu/Challenge
>> _______________________________________________
>> qooxdoo-devel mailing list
>> qooxdoo-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 « Return to Thread: Iframe source change