Question

This is not related to the domain like many other similar posts with the same error message.

Here is my set up:

<iframe src='somepage' />

user can open a window popup from within somepage and window.open is used. Assume my popup remain open and a new source page 'secondPage' is swapped into the same iframe. My popup can still its 'opener' but whenever i try to access the opener, it will throw an access denied scripting error.

so my question is, how can i either access it or check to see if it closed so i dont try to access it? i tried to check if window.opener.closed and apparently is returning me a false.....

Was it helpful?

Solution

Your opener will have a property called closed which you can check to see if it's has been closed (or navigated away). If it's closed, checking any other property on the opener will throw an error because the window object has been destroyed.

I just noticed that you knew about the closed property. I've used this before and I never had problems.

What browser are you using? Post the code you're running. If all fails, use a try catch to detect that an error occurred while accessing the opener.

IE IFRAME BUG What you've described is listed as bug in a comment on http://msdn.microsoft.com/en-us/library/ms533574(v=VS.85).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top