Forum Moderators: open

Message Too Old, No Replies

How to auto close window using javascript?

Auto close window

         

Jasmine_V

12:07 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



How to auto close window using javascript without the pop-up message of "Do you want to close the window?"

BlobFisk

4:01 pm on Feb 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Jasmine_V,

You can only use JavaScript to close a window without this security warning, if the page was opened by either a target="_blank" or a JS window.open from another page.

HTH

Jasmine_V

3:19 am on Feb 27, 2004 (gmt 0)

10+ Year Member



Hi!

Sorry I am a complete idiot when it comes to javascript. Could you let me have the javascript so that I could just cut and paste it?

Thanks!

BarkerJr

4:41 am on Feb 27, 2004 (gmt 0)

10+ Year Member



I think BlobFisk means that you can't close a window that you didn't open using javascript.

thehittmann

6:08 am on Feb 27, 2004 (gmt 0)

10+ Year Member



<a href="" OnClick="window.close()">Close Window</a>

The window will close when you click the link, I dont think you can make one auto close with javascript unless you actully compile some java code yourself and embed it into your page and have it activate as the last step.

You would have to have a great understanding of java programming and a compiler to do this aswell.

tomda

6:13 am on Feb 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well the code below works great.
Simple javascript and it close the page after a certain time.

<script language="javascript">
<!--
setTimeout("self.close();",10000)
//-->
</script>

tommy

thehittmann

6:36 am on Feb 27, 2004 (gmt 0)

10+ Year Member



cool, learn something new everyday