Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear history with javascript

Status
Not open for further replies.

theomen

Programmer
Jun 2, 2004
158
GB
Is it possible to clear the users history for their current session?

I'm writing a login function, which checks if the user currently logging in is the same user as the previously logged in user. If they are, they are returned to the previous page. Otherwise, they are redirected to the home page.

However, if a different user logs in, all they have to do is keep hitting the back button until they get to a page which was accessed by the previous user, which may contain personal info.

So I want the script to clear their history so that they can't use the back button.

I did try getting it to open a new window, and close itself, but if popups are blocked it doesn't work.
 
How about just preventing the browser from caching your pages?

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
I've tried putting "<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">. " into the meta tags, but doesn't work.
 
Here's another one (not positive of syntax):
Code:
<meta http-equiv="Expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
(random date from a website)
or
Code:
<meta http-equiv="Cache-Control" content="no-cache">
found at
--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
Nope, neither of those worked either.

I also tried putting the tags at the bottom of the pages, as advised at but when I log out of my system, then hit the "back" button, my calendar appears with all my appointments, until I hit refresh.

Will leave it for tonight, its 11pm and got a long day ahead :)

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top