Does anyone have a quick script that would pop an alert that you will lose any unsaved information when they click on the browser back button?
Much appreciated!
Does anyone have a quick script that would pop an alert that you will lose any unsaved information when they click on the browser back button?
Much appreciated!
This may be what your looking for I'm not a programmer but it seems to be on point.
QHF
"This is an Emergency?"
Heres what I use:
HTML Code:<input type="button" value="Go Back" onClick="history.go(-1)">
Oh crap .... I am getting old - That isn't even close to what you asked for! Sorry....
I hear this one works:
Code:<script language="JavaScript" type="text/JavaScript"> var postback = false; window.onbeforeunload = confirmExit; function confirmExit() { if (postback == true) { event.cancelBubble = true; } else return 'NOTE!!: Please save before leaving this page. Your information will be lost if you choose to navigate away from this page.'; } </script> <asp:Button runat="server" ID="btnDoRegisteredPostback" Text="DoRegisteredPostBack" OnClientClick="postback=true;return true;" /> <asp:Button runat="server" ID="btnDoPostback" Text="LeavePage"� onclick="btnDoPostback_Click"� />