I am trying to access the opener of a popup using the window.opener reference in the popup's script file.
Consider the following script included in the popup.html:
http ://localhost/test/popup.html
<script> alert(window.opener.test_dom); </script>
This works when no iframe is involved, we will see the alert message from popup.html:
http ://localhost/test/base.html
<html> ... <script> var test_dom = 'test_dom'; var popup = window.open("http://localhost/test/popup.html",... </script> </html>
The problem exists when there are 3 files.. a container page with an iframe in it that launches a popup from within that iframe. This does not show the alert message when popup appears:
C:\TestContainer\container.html
<html> ... <iframe src="http://localhost/test/base.html"> <script> var test_dom = 'test_dom'; var popup = window.open("http://localhost/test/popup.html",... </script> <iframe> </html>
Perhaps this is a security restriction? AFAIK base.html and popup.html are in the same domain, so I see no reason why this should be. Are there other ways to access the opener via other DOM attributes in the popup.html script? I've been stuck on this for a day now.
Other than the reference to opener, everything else seems to work as expected in all scripts.
Using IE 11.
Any assistance is appreciated!