homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

JavaScript: Interrupting Back, Forward and Refresh
Anyway to do this?

WebmasterWorld Senior Member 10+ Year Member

Msg#: 305 posted 11:50 pm on Mar 11, 2003 (gmt 0)

OK, so I want to interrupt the click of a back button and display a warning message - "By clicking back you will lose all of the information you have just entered! Do you wish to proceed?" - yes / no

And the same for refresh...

Is this possible? -- purely with javascript.

I can't find anything that says it is...

Thanks for any help :)

PS. This isn't a request for an discussion on hijacking browsers... it's a bad idea. This is a web application situation where back and refresh break the app. I also have don't have full control over the app so redesigning it isn't an option either. Finally I can't hide the toolbar :) - I love this contract ....

[edit]Clarified with purely javascript[/edit]



WebmasterWorld Senior Member txbakers us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 305 posted 3:55 am on Mar 12, 2003 (gmt 0)

The built in buttons of the browser such as Back and Refresh can not be overridden. Just as a person can simply close the browser and leave your app. You just have to code for that.

If it's a problem where people lose information by going back, they will learn soon enough not to go back. The user must take some responsibility.

You can code your own back and refresh buttons, which would display a warning, but you can't override the built in browser buttons.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved