Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you close a previous window when a new window is opened?

Status
Not open for further replies.

Kruzer

Programmer
Jun 16, 2000
117
US
A brain fart question,<br><br>How do you close a previous window when a new window is opened?<br><br>example -<br><br>Window 1 is opened a user clicks on a link and opens a new window. Window 2 is created and I need Window 1 to close behind and Window 2 is the only window open.<br><br>Should be a simple, ArrrrrgH!<br><br>Kruzer <p>Dano<br><a href=mailto:dskryzer@hotmail.com>dskryzer@hotmail.com</a><br><a href= > </a><br>What's your major malfunction
 
I've found that just putting window.close() or self.close() in the generation script in window 1 works ok with one problem; Javascript will put up a requester asking the user for permission to close the window if the first window wasn't generated by javascript. Here's an example from a project I'm working on.<br><br> newwindow=window.open();<br> newdocument=newwindow.document;<br> newdocument.open();<br> newdocument.write(&quot;&lt;HTML&gt;&quot;);<br> newdocument.write(&quot;&lt;/HTML&gt;&quot;);<br> newdocument.close();<br> self.close(); //closing the original window<br><br>It would be cool if I could get rid of the requester.<br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top