This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to stop browser window closing  RSS feed

 
Venkata Ramana
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In javascript onbeforeunload event i called a method. as
<body onbeforeunload=fun>
This event is when i clicked on 'X' on top right corner.(i.e. before closing the browser window)
in 'fun' function i want to stop the browser window closing. how can i achieve this.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<SCRIPT LANGUAGE=JavaScript FOR=window EVENT=onbeforeunload>
<!--
var strMsg = 'Leaving this page with will cause you to loose any information you have entered'
window.event.returnValue = strMsg;
// -->
</SCRIPT>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!