Clear history of browser using JavaScript

Posted on 2003-03-21
Medium Priority
Last Modified: 2008-01-09
iam having prob with clearing history of the browser

i tried both the methods that ate sujjested previouly in this site

i tried the following one
   In present page, add
       document.location = 'nextpage.html';

   Then create a new page, say 'nextpage.html' and add
         document.location = 'myhomepage.html';

but those methods works when there are no frames.

but when i call a "LOGOUT" option form one of the frames..only that forms history is been cleared.but i want to clear complete history in the browser
even i have the logout option in any frame..

Question by:gopalleela
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8180317
Try changing document.location to top.location.href
LVL 19

Accepted Solution

webwoman earned 100 total points
ID: 8182108
You CANNOT clear the browser history.
LVL 15

Assisted Solution

JakobA earned 100 total points
ID: 8183263
Normally you do not have permission to read or change data in the historry array. To many possibilities for misuse (eg: which other websites has he visited so who should i sell his email adress to?)

So you cannot clear the history array.

There are a few things you can do:
1) you can overvrite the current entry when loading a new page
      window.location.replace( "newpage.html" );
2) you can see the adress that linked to the current one prowided it was a standard html-link that led here:
      var priorpageURL = document.referrer;
3) go to any page in history using the history.go( number ) metnod. But not that that does not tell your scipt which page  you are going to.

best JakobA
LVL 16

Expert Comment

ID: 10149185
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: webwoman {http:#8182108} & JakobA {http:#8183263}

Please leave any comments here within the next seven days.

EE Cleanup Volunteer

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question