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

alert() on history.back() event

Status
Not open for further replies.

giles100

Technical User
Feb 18, 2007
10
GB
Hi,

I’m working on a dynamic site that’s made up of many pages. I’m providing the user with a easy to use navigation system, but I’m concerned that old habits may cause them to use the browsers back button with disastrous results.

Browsing so far has revealed a range of options from captureEvents and addEventListener (a process that non of the postings I read talk that highly about ... if you can even do it with history.back), through to creaing a new window and removing the navigation bar (I’d rather avoid opening new windows).

I’m left tonight wondering if it’s simply possible to attach a simple alert() that will be called if history.back() gets triggered, and breaking the command if they select NOT to go back .... I’m wondering if that’s possible?

any ideas?
thanks
Giles
 
Unfortunately no. There is no [tt]history.back()[/tt] event. Only a method that you can call, in which case it would be simpler to not call it. :)

Opening a new window is probably your best bet... assuming that this is some sort of intranet/extranet application that your users will be receiving some training in.

Otherwise you're kinda stuck with the back button. What is it that makes you uneasy about letting users hit the back button? Maybe there is a way around that[/t] problem instead.

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]

Enable Apps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top