0

Possible Duplicate:
Is there a way to catch the back button event in javascript?

In my application,the user can enter data eithe add or modify those modification is saved into database using ajax.After all the modifications is completed in the screen then user will be finalized the data.In the time,user accediently click on Browser 'Back' Button.

So,what i need is,if user clicked without 'Update' button then if clicks the Browser 'Back' button.i want to shown the alert message.So,How to detect/capture the 'Back' Button.Please help me

Community
  • 1
  • 1
user1127214
  • 3,109
  • 7
  • 26
  • 30

2 Answers2

0

You could use the window.onbeforeunload event

Jibi Abraham
  • 4,636
  • 2
  • 31
  • 60
0
<body onunload="Unloader()">
<script type="text/javascript">
    function Unloader() {
    }
</script>
epascarello
  • 204,599
  • 20
  • 195
  • 236
Philip Sheard
  • 5,789
  • 5
  • 27
  • 42