What is the correct syntax for getting the URL (Specifically, the PATH) of the parent window from a modal dialog box in Internet Explorer.
I have tried numerous variations on:
window.opener.document.location
window.opener.location
this.opener.document.location
window.opener.location.pathname
window.opener.document.location.pathname
But all of them result in an IE javascript error: “Document is null” or “location is null”#
As a side note, in Chrome and FF, this line works fine:
window.opener.location.pathname
and in IE, this line is fine for the CHILD windows PathName
document.location.pathname
Seems it is something to do with “opener” ?
I have also tried a suggestion of changing security settings in IE. THis also failed – besides, this wouldn’t be an appropriate fix for clients!
Edit: Just tried window.opener.newMethod() and linking it to a method in the parent page. This returned an error too. Its definately the way the parent is being called!
I am basically in need of checking if the parent page is /somepage.aspx and then send a “document.forms[0].submit()” to force a refresh
Edit: Restrictions mean I cannot implement anything other than a Modal Dialog
I would highly recommend switching to jQuery and their built-in modal dialog popup’s for 2 reasons. 1 is that you don’t risk the chance that a popup-blocker would block the initial request to open the dialog and the 2nd is it makes the process of programming/adding on to the site and manipulating MUCH easier to work with.
I’m sorry I can’t furnish you with any other answer.