Felipe Sodre Silva
Felipe Sodre Silva

Reputation: 221

Changing history entries in Firefox Browser with JavaScript

Firefox has a security privilege called UniversalBrowserRead, with which I'm able to read the history entries of the current window. There's also a UniversalBrowserWrite, but I couldn't use it to change history entries, like:

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
for(var i = 0; i < history.length; i++)
  history[i]='http://www.google.com';

Does anyone know how to make it work (if possible at all)?

Upvotes: 1

Views: 426

Answers (4)

Boris Zbarsky
Boris Zbarsky

Reputation: 35074

You'd need UniversalXPConnect to modify the history that way.

Note that enablePrivilege is deprecated and being slowly removed, so I wouldn't write new code depending on it...

Upvotes: 1

Joe Hanink
Joe Hanink

Reputation: 4847

the best you can do in javascript is change the last entry using location.replace()

Upvotes: 0

xavierm02
xavierm02

Reputation: 8777

You can't...

http://hepunx.rl.ac.uk/~adye/js12/scripts.htm

In the table 'JavaScript Features Requiring Privileges'

history object:

Getting the value of any property <=>UniversalBrowserRead

Setting the preference property <=> UniversalBrowserWrite

It says you can change preference, not value.

Upvotes: 0

Tyler Egeto
Tyler Egeto

Reputation: 5495

When I Google'd for 'netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");' this was the third result:

Firefox and UniversalBrowserWrite privilege

Upvotes: 0

Related Questions