views:

604

answers:

2

How to clear browsers (IE, Firefox, Opera, Chrome) history using JavaScript or Java, except clearing it from browser itself?

+1  A: 

In short it's not possible, sandboxing prevents browsers and the scripts/applets they run to modify or even create any files except for a few narrow cases. Javascripts and Java applets being allowed to clear other websites cookies or site content in your cache would not be desirable.

kb
But i certain banking website it is possible. Then how they had done that.
Yogi
A: 

The document.location data in browsers is generally inaccessible to scripts, because allowing access would give any given site access to your entire browsing history. At most you can do a few simple manipulations, like "go to history entry #37" or "go back one page". But you can't do "what was the address of the page in history entry #23".

Most banking sites will use javascript links to prevent a click history from being built up. They'll do document.location.replace" to kill the last history entry (the current page) and replace it with the address of a new page. It in effect removes the "back" option to go back a page, because the previous page (as far as the browsing history is concerned) is now the new page.

Marc B