...

View Full Version : Viewing history in javascript



bubbles19518
12-12-2006, 11:42 PM
Hi, I've been messing around with javascipt and the history and I cant get it to print out my history... Here is my script:


<script language="JavaScript">
document.writeln("<B>history:</B> " + history);
</script>

That tells me its an object, which I know so I try:


<script language="JavaScript">
document.writeln("<B>history:</B> " + history[0]);
</script>

Which gives me nothing... Any help?

nikkiH
12-13-2006, 01:20 AM
History is protected and, in theory, should never be exposed to script for anything other than going back and forward. It would leave people vulnerable to privacy violations.
That said, I bet there are hacks out there if you look.

Puffin the Erb
12-13-2006, 10:27 AM
If the browser supports Netscape signed scripts ( such as Firefox ), then just place the following line before your code to invoke the security manager :


netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

The user will then be able to Grant or Deny the privilege.

An error will be generated in non-supporting browsers so test for the capability first.

nikkiH
12-13-2006, 02:03 PM
Doesn't that require a signed script?
http://www.mozilla.org/projects/security/components/signed-scripts.html

You can't just make any script and use that, can you?

Puffin the Erb
12-13-2006, 04:22 PM
No, it doesn't require signing, the user can decide whether they want the code to run, with or without a signature. However, they would be more likely to allow the script if it has been signed.

Personally, I would not allow, or use, such scripts for security / privacy / cross-browser compatibility reasons unless developing for an intranet, however, it is proof of concept.

nikkiH
12-13-2006, 07:41 PM
Ah, gotcha.
Generally speaking, I don't allow anything to run if the browser had to ask me about it in the first place. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum