Jump to content

OnBeforeUnload help!!!!


tdope21
 Share

Recommended Posts

Hey guys,Here's the problem we're facing...When a user exits one of our pages we need to confirm with them that "if you leave this page, all your info is lost. Continue? yes? no?"That's the easy part. The parts that we are struggling with is that we're not sure how to call one of our methods if they do click "yes, I want to cancel". We have a delete method that will erase the data up to that point. And if they try to navigate away from that page, how to let them go. So if they type in a URL, how to pop the confirm box, hit our delete method, then let them go surf where ever they desire.Out of all of the examples that I've seen online the OnBeforeUnload seems like the best way to go, but we're just not sure how to get it to work the way that we need.I'm mainly doing this research for a comrad of mine and I don't have access to the code or else I would've sent what I had for you guys to pick through. I just know that it's been something that has been a pain in the neck to figure out.Help, thoughts, strong drink, all appreciated.

Link to comment
Share on other sites

I believe onbeforeunload is used in Internet Explorer and onunload is the event used in other browsers. I'm not entirely sure, I haven't worked with them in a long time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...