Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to stay at the current page without reloading?
Message
From
02/02/2007 21:25:17
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
How to stay at the current page without reloading?
Miscellaneous
Thread ID:
01192067
Message ID:
01192067
Views:
84
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"
}
Next
Reply
Map
View

Click here to load this message in the networking platform