views:

96

answers:

4

It's possible to clear browsing history using javascript?

If yes, how can I do this?

Note: A lot of forums said no, but some said yes, so I'm lost.


EDIT

Note: I want to clear only the last pages in mydomain (random pages in mydomain).

+3  A: 

Even if you could, you shouldn't.

Stefan Kendall
Why I shoundn't? (I edited my question.. is only in my domain)
Topera
It breaks what the user expects, and it would hijack what should purely be a function of the browser.
Stefan Kendall
+5  A: 

No.

That would be a security issue, if it were possible: a website you visit could maliciously delete all your browsing history without your permission.

However, it is possible to clear the history in javascript within a google chrome extension. Take a look at chrome.history.deleteAll().

Eric
If script runs in the SAME domain that history page, I don't think that is a security issue. By the way, thanks your anwser! :)
Topera
Ah, so you want a site to clear all of _its_ history entries?
Eric
@eric yes!!!!!!
Topera
+2  A: 

Javascript is a closed box; you can't change files on a clients computer, which is essentially what this would be doing.

So nope, you can't.

Zachary
And thank goodness for *that*.
David Thomas
+1  A: 

there are ways to go about preventing the user from going back a page, but to completely clear your entire browsing history is not possible. let alone deleting any of it

Ascherer
You said "completely clear your entire browsing history is possible." Did you mean NOT possible?
aaaa bbbb
yes, yes i did lol, my bad, i originally wrote not impossible, then change it to just possible, my bad
Ascherer