I have a problem with the window.opener function (JS):
I created 3 simple pages to simulate my problem:
test.php:
<html>
<head>
</head>
<body>
<input type="button" onclick="window.open('first_page_in_popup.php', 'Popup', 'width=470,height=500');">
<input type="text" id="content" name="content" >
</body>
</html>
first_page_in_popup.php:
<html>
<head>
<script type="text/javascript" >
window.opener.document.getElementById('content').value= "Test from first page in popup";
window.open('second_page_in_popup.php', 'Popup');
</script>
</head>
<body>
</body>
</html>
second_page_in_popup.php:
<html>
<head>
<script type="text/javascript" >
window.opener.document.getElementById('content').value= "Test from second page in popup";
</script>
</head>
<body>
</body>
</html>
Result: In IE, the input field has the content "Test from second page in popup". In Chrome and Firefox, the content is : "Test from first page in popup".
The Error Message:
window.opener.document.getElementById(...) is null
try parent.window.opener
instead of window.opener
Source: window.opener is null in firefox