Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
How to communicate between WebDialogWindow and "opener" web page?
posted

I have just started using the WDW and am trying to achieve 2 things, but have been unsuccessful:

  1. Close the WDW using javascript from within the web page displayed in the WDW itself. When the user clicks on a button, for instance.
  2. Generally communicate data back to the "parent' or "opener" web page.

 

I first tried to get hold of the WDWcontrol in javascript using $find(), per the documentation, but $find() returned null. On further examination, I discovered that the window.document only contained the html for stuff "inside" the WDW. The reason $find() wasn't helping me was that I was on a web page that behaved as if it were inside a new browser window instance.

In other situations when I have opened another browser window myself, I have called back to a javascript function on the parent window using the window.opener property. However, this property was null. It was my understanding - again from the documentation - that the WDW used a div and display:none or something, to get around popup blockers; but this was not the case. Yet it's not "opening" a window in the conventional sense, either. Obviously I'm not understanding the architecture, here. Prolly some AJAX callback mechanism that is beyond my current skills.

Can somebody help me achive goals 1 and 2 above? Thanks.

-BillyB

  • 24497
    posted

    Hi BillyB,

    If you use ContentUrl, then content of child aspx or external website is rendered inside of iframe. So, you may use parent, opener, etc, to get references to elements/objects located in document which holds dialog.

  • 600
    posted

    I've poked around some more and I have a solution that I'll post here, followed by a question.

    It seems IG uses IFRAMEs to create these the WDW  controls. This means you can get access to the parent frame using the "parent" property. So to close the WDW "window" using javascript from the web page "inside" the WDW control, attach this to some onclick event or something:

    parent.$find('ctl00_wdwMessage').hide();

     You can use this same technique to access other elements and javascript functions on the "parent" page.

    My only question at this point is this - is there anything I need to know about cross-browser compatability, here? I'm not worried about ancient browsers, but I am worried about FireFox, Safari, etc. Will they work the same?

    Thanks in advance,

    -BillyB