tags:

views:

854

answers:

4

Possible Duplicate:
Disabling Back button on the browser

Hi Guys, I need to disable the backbutton of browser window.When I click on backbutton,I need to show one message using alert or other means.Any one can help me

+4  A: 

Short answer: don't.

There's something wrong with the design if you have to do this.

alok
There are times when you need to show the prompt each time user navigates away from the page, this could be the case. For example if the page manages some list where you put elements and have to save them in the end, you could show "Are you sure you want to exit, you changes are not saved" message.
Max
yup, I agree with Max. Gmail did a great job with this.
andyk
A: 

See How do I disable the "Back" button of a browser?

eed3si9n
nice one. The tricks there are indeed clever.. but they are a bit.... scary. Close the current page and then reopen in new window ? lol
andyk
+5  A: 

you can't make the user stay on your page, but you can give a yes/no prompt first, though.

read around http://stackoverflow.com/questions/261083/is-there-a-way-to-determine-that-the-browser-window-was-closed

andyk
+2  A: 

I HATE it when web pages do this. I'd suggest another way of approaching the usability of your page first.

barfoon