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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear the browser history using javascript 1

Status
Not open for further replies.

mitch77

Programmer
Nov 16, 2000
42
PT
How can I clear the browser history, using javascript??

I think that it's not possible, and one of the solutions i have is to define a timeout, but i don't have any idea how to do that.

thanks, Mitch Jeffers
 
You mean to emulate the functionality of:

Tools-->Internet Options-->Clear History

You can't do this with browser-based js. jared@aauser.com
 
OK i can't emulate it, but some pages when i press the back button appears with the error "This page expired" , or something like that.
how can i implement this??
 
that is because you posted a form, or something to that page and the content is dynamic. it should say the page has expired, would you like to post the form data again, or something like that. you can't do that with javascript.
 
don't feel like testing this, but it might work. try putting this line in the head of all your documents (inside script tags of course):

history.forward() jared@aauser.com
 
Jared, that suggestion looks familiar ;-) That will prevent you from going "back" while on your site, however, you can still access the history list and go back to before you were on your site, so it doesn't quite clear the history, but it may accomplish what Mitch is trying to do.

Also, I think history.length is read-only, but if not, then you could try setting history.length=0.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top