J
Jim Davis
The scenario: 1) Generate a popup window via script. 2) Populate it (again
via script) with content that features local (hash) links.
In IE 6.x this works - the links work as they should, moving the document to
that document position. However in FireFox 1.x the links load the main page
(the opener) in to the popup.
Both browsers populate the location.href of the popup with the main page's
href... but this only adversly affects FireFox (which seems to, in this
scenario, reload the whole page on a local link). I tried manually
populating the location.href but no joy.
I've appended an example which demonstrates the problem. I've tried to
shave it down as much as I could. Just save it to an HTML page and load it
up in FireFox. Click the button then scroll down and click the link...
instead of returning to the top of the page I get the opener page's HTML
populated into the popup.
Any thoughts on how to address this? I've Googled, but it may just be that
I've been unable to hit on the right terms to uncover the answer.
Thanks in advance for any direction,
Jim Davis
<html>
<head>
<title>Test Page</title>
<script type="text/JavaScript">
function CreateTestPopup() {
// Create Window
TestWindow =
window.open("","TestWindow","scrollbars=yes,resizable=yes,width=500,height=400");
var TW = TestWindow.document;
// Write the HTML
TW.write( "<html><head>",
" <title>Test Window</title>",
"</head><body>",
"<a name='PageTop'>Page Top</a>",
"<br><br><br><br><br><br><br><br><br><br><br>",
"<a href='#PageTop'>Go To Page Top</a>",
"</body></html>");
};
</script>
</head>
<body>
<p>This is just a test page.</p>
<p><input type="button" onclick="CreateTestPopup();" value="Launch
Popup"></p>
</body>
</html>
via script) with content that features local (hash) links.
In IE 6.x this works - the links work as they should, moving the document to
that document position. However in FireFox 1.x the links load the main page
(the opener) in to the popup.
Both browsers populate the location.href of the popup with the main page's
href... but this only adversly affects FireFox (which seems to, in this
scenario, reload the whole page on a local link). I tried manually
populating the location.href but no joy.
I've appended an example which demonstrates the problem. I've tried to
shave it down as much as I could. Just save it to an HTML page and load it
up in FireFox. Click the button then scroll down and click the link...
instead of returning to the top of the page I get the opener page's HTML
populated into the popup.
Any thoughts on how to address this? I've Googled, but it may just be that
I've been unable to hit on the right terms to uncover the answer.
Thanks in advance for any direction,
Jim Davis
<html>
<head>
<title>Test Page</title>
<script type="text/JavaScript">
function CreateTestPopup() {
// Create Window
TestWindow =
window.open("","TestWindow","scrollbars=yes,resizable=yes,width=500,height=400");
var TW = TestWindow.document;
// Write the HTML
TW.write( "<html><head>",
" <title>Test Window</title>",
"</head><body>",
"<a name='PageTop'>Page Top</a>",
"<br><br><br><br><br><br><br><br><br><br><br>",
"<a href='#PageTop'>Go To Page Top</a>",
"</body></html>");
};
</script>
</head>
<body>
<p>This is just a test page.</p>
<p><input type="button" onclick="CreateTestPopup();" value="Launch
Popup"></p>
</body>
</html>