Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 551
  • Last Modified:

Clear history of browser using JavaScript

hi
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
    <script>
       history.go(-history.length);
       document.location = 'nextpage.html';
    </script>

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




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..

0
gopalleela
Asked:
gopalleela
2 Solutions
 
AntithesisCommented:
Try changing document.location to top.location.href
0
 
webwomanCommented:
You CANNOT clear the browser history.
0
 
JakobACommented:
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
0
 
jaysolomonCommented:
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now