|
-
Jan 16th, 2008, 12:30 AM
#1
Thread Starter
Hyperactive Member
catch back button in web browser
Hi guys,
Is there a way to catch the back button in web browser?
Let's say a user logs in then he goes to the viewdata.aspx after which he then goes back to the main page and logs out.
What i want now is whenever he hits the back button he will then be redirected to the login.aspx.
I tried using sessions and it works if only the user types in the url but if hits the back button he can still view the cached data.
I don't want to disable the caching of my webforms since it (i think) i slows the web page and also because it prevents the user to view data that is being cached since the user is still log on.
Thanks and God bless
-
Jan 16th, 2008, 06:05 AM
#2
Re: catch back button in web browser
It doesn't "slow" the web page, it will make sure that the page is loaded from the server each time, but the difference is minimal, as that is the right solution. This way as long as the user is logged in, he can view what's on viewdata.aspx.
-
Jan 16th, 2008, 09:54 PM
#3
Thread Starter
Hyperactive Member
Re: catch back button in web browser
Actually the user can not view the page that he visited whenever i disable the caching. it automatically expires whenever the user hits the back button eventhough he is still log in. I just like to trap the back button or the forward button, everything else is ok since i am using session. i only disable the caching part on the pages that requires update and insert since these pages requires click event to process transactions. Thanks
-
Jan 17th, 2008, 07:50 AM
#4
Re: catch back button in web browser
You can introduce a "Thank you for submitting that information" page which does a javascript location.replace so that when the user clicks back, he ends up on the thank-you page which redirects him forward anyways.
You can't really 'catch' a back button event as it is a browser event, not a server side one.
-
Jan 17th, 2008, 07:41 PM
#5
Thread Starter
Hyperactive Member
Re: catch back button in web browser
but can i have little sample.
Thanks
-
Jan 18th, 2008, 04:48 AM
#6
Re: catch back button in web browser
Is what I've described really that difficult? Can you at least perform a few searches and find some code that you try to put together? (And show us where you're stuck)
-
Jan 20th, 2008, 09:55 PM
#7
Thread Starter
Hyperactive Member
Re: catch back button in web browser
 Originally Posted by mendhak
Can you at least perform a few searches and find some code that you try to put together? (And show us where you're stuck)
that's why maybe i'm here to do a research. thanks anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|