We help IT Professionals succeed at work.

User closes out Internet Explorer, what to do? use onbeforeunload?

michael1174
michael1174 asked
on
If a user closes out of Internet Explorer by using the X in the top right corner, how can I prompt the user and ask them if they want to save or cancel the transaction?  If they want to save, I need to call a C# SaveValues() method, if they want to cancel, I need to call a C# RollBack() method.  Is this possible? Do I need a pop up?  I read dont use popups, because pop up blockers will cause them not to load.

Whats the best solution using asp.net 1.1, c#, javascript...

Thanks!
Comment
Watch Question

I would use onbeforeunload with a confirm("Do you want to save your data?")

then if it returns true execute an Ajax call to the server side code to call save otherwise execute RollBack

Explore More ContentExplore courses, solutions, and other research materials related to this topic.