By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,325 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,325 IT Pros & Developers. It's quick & easy.

How can I clear the history of a browser page by using scripts or programming

P: 16
How can I clear the history of a browser page by using scripts or programming
Feb 27 '08 #1
Share this Question
Share on Google+
3 Replies

Plater
Expert 5K+
P: 7,872
You can't. (As far as I am aware)
What you *CAN* do, is dictate that your pages are never cached in the first place though. Response.CacheControl or something like that should contain information on to do that.
Feb 27 '08 #2

gagandeepgupta16
P: 56
hi

try this,

//clears browser history and redirects url
Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE=javascript> 
  2. {
  3.  
  4.   var Backlen=history.length;   history.go(-Backlen); 
  5.   window.location.href=page url
  6.  
  7.  }
  8.  
  9. </SCRIPT>
  10.  

I found this at the below link
http://forums.asp.net/t/1132444.aspx

it worked for me...
Mar 18 '08 #3

Frinavale
Expert Mod 5K+
P: 9,735
This sounds like a terrible idea.

You're clearing a persons browser history...that means that all of their browsing history will be destroyed when they visit your site...they may actually depend on it to find some websites they forget the links to.

I would do as Plater says, state that your page is not to be cached by setting meta tags:

Expand|Select|Wrap|Line Numbers
  1. <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  2. <META HTTP-EQUIV="EXPIRES" CONTENT="0">
  3. <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
  4.  
Do this using the Response.CacheControl that Plater was talking about.


-Frinny
Mar 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.