popup closes main window problem

D

David

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>
 
G

Grant Wagner

David said:
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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top