KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a form where the input fields are saved onChange . In Firefox (5) this works even when the window is closed, but for Chrome and IE it doesn't and I need to be sure that I'm saving this data even if they try to close the window after they've typed in a field but an onBlur event hasn't occurred (i.e. they've typed something into a textbox, but haven't tabbed out of it). I have read the following SO articles on using window.onbeforeunload : article 1 article 2 if I use the following: window.onbeforeunload = function() { return "onbeforeunload"; } then I get a popup with onbeforeunload in. but if I try: window.onbeforeunload = function() { alert("onbeforeunload"); } then nothing happens in any browser, even Firefox. what I want to achieve is: window.onbeforeunload = function() { saveFormData(); } I'd be grateful if someone could point out where I might be going wrong.
Tags (comma-separated)
Save Edits
Cancel