David wrote:
Hi,
I have a simple page on my freebie account site that opens a popup
window running index.asp on another site of mine. The code on the
freebie hosted server is below. What I'd like to do is have the
freebie hosted page shut down once it's opened up the child window.
Any ideas? Thanks
David
<html>
<script language="JavaScript" type="text/javascript">
function popup() {
window.open( "http://www.mysite/index.asp" ,
'newwin','toolbars,menubar,scrollbars=yes,toolbar= 1' ) ;
}
</script>
<BODY onLoad="javascript:popup()">
</body
</html>
<body onload="popup();window.close();">
Since you likely didn't open the window the person is viewing the page
containing the above with script, the user will either be prompted
whether they want the window to close (IE, Netscape 4), or it will fail
with an error in the JavaScript Console (Mozilla).
You can't close a window with script that you didn't open with script
(it's more complicated then that, but that's the basic idea)
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html