Hi all,
I have a javascript running whenver the form's onunload event fires. The javascript will popup a confirm box to ask user whether to stay at the current page or redirect to somewhere else.
Howoever, when I use " window.location.href = window.location.href ", the page will be reloaded, which some changed values on the form will be missing. Therefore, I added a hash, window.location.href = window.location.href + "#", but it's not working. I have tested with " __doPostBack('__Page', '') ", but somehow it's not working in some forms. Is there a way to stay at the page without reloding the page? Thanks.
Here is my javascript:
function onPageUnload()
{
var result = confirm("Do you want to leave the page?")
if (result)
window.location.href = window.location.href
else
windwo.location.href = "./Logout.aspx"
}