PDA

View Full Version : Cross Domain Modal Window Close Question



mawtino
06-13-2011, 11:16 PM
1) Script Title: Window Widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem:

Ok, this is convoluted so bear with me. The script is located on my server. The page that is opened in the iFrame is on my server. But the page that is calling the script is in a different domain. So a 3rd party is executing the script from my domain and it opens a page in my domain in the iFrame but the executing page is in a different domain...

I know there are cross-domain security issues but is there truly no way to close the iFrame from within the iFrame in this instance? When I use parent.ANYTHING it returns "Unsafe JavaScript attempt to access frame with URL"...

:confused: HELP! :confused:

traq
06-13-2011, 11:37 PM
Since you control both source domains, you might look at cross-domain messaging (http://ejohn.org/blog/cross-window-messaging/). not many browsers support it yet, however.

since the containing page opens the iframe, why can't it be responsible for closing it?

mawtino
06-14-2011, 02:56 AM
The user must click "Yes, I'd like to take a survey" within the iFrame and that is supposed to open a separate popup and close the dHTML window. But I don't control the domain that pops the actual window, only the content in the iFrame and the script file itself.

traq
06-14-2011, 03:15 AM
So.... is this correct?

Page = not yours
iFrame page = yours (though the iFrame itself is not yours)
dhtml script = yours
---Question 1: how does the Page get your dhtml script? do they simply link to it (i.e., <script src="www.yoursite.com/dhtmlwindow.js">)?

1) the Page opens your dhtml window.
2) if the user clicks "yes," your dhtml window opens a popup with an iFrame, showing the iFrame page.
---Question 2: what is this "popup"? is it another dhtml window or similar modal window? is it a new browser window?
3) you want the original dhtml window to close at this point.

...correct?
Please post a link to the page on your site that contains the problematic script so we can check it out.