No replies
roscoe
roscoe's picture
Offline
Enthusiast
Last seen: 13 years 28 weeks ago
Joined: 2006-03-09
Posts: 138
Points: 0

I have an app that will pop up a confirm using the onbeforeunload action if the user tries to close their firefox browser or tab when they haven't saved their data. The problem is that it's not working beause I can't prevent the default action. My code is below and I can't figure out why it doesn't work...

	window.onbeforeunload = function() {
		var value = confirm("Do do this!");
		if (value == false) {
			event.preventDefault();
		}
	}

Tags: