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("Uni开发者_Go百科versalBrowserRead");
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)?
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...
When I Google'd for 'netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");' this was the third result:
Firefox and UniversalBrowserWrite privilege
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.
the best you can do in javascript is change the last entry using location.replace()
精彩评论