i know that i can run a script in <body onunload="funtion();">
what i want to know is, can i stop the user from leaving if they accidentally clicked exit. the reason is that i'm making a data entry page, and if they leave the page, their session state is ruined.
i know that you can do a <form onsubmit="return confirm();"> and if confirm() is false then it won't submit, but this doesn't work for leaving a page.
i realize that this probably wasn't intentionally built right into iexplore because it'd be pretty crappy to get a malicious programming that wouldn't let you leave his site, but does anyone know any workarounds?
the only thing i can think of is
<body onunload="if (!confirm('are you sure you want to leave')) { window.location.href=unescape(window.location.href); }">
but then i lose the form elements that had been submitted to the page....unless maybe i used get instead of post...i'll try that.
thanks. mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
what i want to know is, can i stop the user from leaving if they accidentally clicked exit. the reason is that i'm making a data entry page, and if they leave the page, their session state is ruined.
i know that you can do a <form onsubmit="return confirm();"> and if confirm() is false then it won't submit, but this doesn't work for leaving a page.
i realize that this probably wasn't intentionally built right into iexplore because it'd be pretty crappy to get a malicious programming that wouldn't let you leave his site, but does anyone know any workarounds?
the only thing i can think of is
<body onunload="if (!confirm('are you sure you want to leave')) { window.location.href=unescape(window.location.href); }">
but then i lose the form elements that had been submitted to the page....unless maybe i used get instead of post...i'll try that.
thanks. mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu