Skip to main content
August 26, 2009
Question

is it possible to close a window (browser) without the confirmation request ?

  • August 26, 2009
  • 1 reply
  • 634 views

is it ? how ? thanks !

This topic has been closed for replies.

1 reply

Participating Frequently
August 26, 2009

Hello Sw Jiten

Simply place this code in the head section after any PHP code you are wanting to execute of the page you want to self close without any confirmation.

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

You can change the number 3000 to number you want.

The lower the number the faster the page will close.

The higher the number the page will take longer to close.

Hope this helps

Stan Forrest
Digital Magic Show

August 28, 2009

I am afraid I didn't explain myself clearly... thanks for your response but whta I mean is :

I need to close it without confirmation, but using a button. I mean, I need to place a button, and whe you click on it, closes the browsers.. so it does not go on asking you "this command is trying to close the window..." ... it simply closes.... any idea ?

David_Powers
Inspiring
August 29, 2009

For security reasons, the only way to close a window without confirmation is if the window was originally opened by JavaScript. This is to prevent malicious scripts from causing a browser to exit.