Jump to content

Close page


Fire Dragon

Recommended Posts

I would only use this on a pop up window, not your main window. but you can if you want

<head><script>function check(){var answer = confirm ("Do you want to close this window?")if (answer)window.close();else alert ("Thanks for staying")}</script></head><input type="button" value="close window" onclick="check()" />

Link to comment
Share on other sites

Well,I saw this kind code somewhere,but I can't remember where,so I decided ask.I want that,when tries close window,function happens.Like,alert "Bye,bye!" orprompt,"are you sure?"Something like this.I have seen this in some sites in web.Thanks for help!

hi! i think it works<body onUnload="confirmOnce()"><script language=javascript>function confirmOnce(){ if (window.event.clientX<0 && window.event.clientY<0) { alert("Bye Bye"); }}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...