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

How to prevent a user leaving the page (by accident)

Status
Not open for further replies.

BabyJeffy

Programmer
Sep 10, 2003
4,189
GB
I've added a new FAQ to the Javascript archives.

faq216-6708

This FAQ gives sample code on how to warn a user before they leave the page - and give them the option of remaining on the page (in the context of the example, this only happens once the form on the page is changed, but not submitted).

I've used this code concept recently for IE6, IE7 and Firefox in Windows without any problems.

I hope others can get some re-use from it!

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Does this trigger if the client attempts to close the window?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Yes... it does.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top