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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On page close or when you leave a page

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
is there a particualar JS call when you leave a page or click the x in the top right corner?

I want to run a function whenever, someone leaves a page by clicking the Update button, or clicking the X in the top corner.
 


In IE this works:


Code:
<script>
function accept(){

  return '* * Warning - You will lose your updated page contents * * ' ;

  // force msg to modal dialog to accept exit from this page


}
</script>




<body  onbeforeunload="return accept();">
 
window.unload = function() {somefunction();}
works in all browsers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top