I've 2 asp.net pages..page A and page B. On clicking a link on page A, user gets redirected to page B.When on page B, if user clicks browser's back button,I need to forcefully invoke page refresh of page A. How do i achieve this functionality? Note:Code needs to be compatible across different browsers...ie IE, firefox, opera, etc
Thanks for reading.
From stackoverflow
-
You could set a session variable on page B and check to see if that session variable exists on page A and handle it accordingly.
Steve Chapman : thanks...but will browser's back button click invoke Page_Load method of page A?Chad Grant : No, not guaranteed. You'll have to use Javascript, its the only thing that is guaranteed to run on a cached page. -
I'd say the best way to do it is telling the browser not to cache the page.
<% Page.Response.Expires = 0; %>
If that doesn't work to your needs, you'd need javascript to force the refresh.
Psuedo code:
if (cookie does not exist) set cookie with 10 second expiration else if cookie exists { is cookie expired? { set new cookie refresh page } }
Bit Destroyer : A word of warning, setting the expiration time to 0 will throw a "Webpage has expired" error in IE7 and force the user to refresh the page. This might throw your users off if they see that error page.Chad Grant : no .Steve Chapman : how do i refresh an asp.net page using javascript? -
There is some button property like Autopostback, you can try it and see if ti helps!
0 comments:
Post a Comment