Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Location
    Colorado
    Posts
    132
    Thanks
    7
    Thanked 1 Time in 1 Post

    Viewing history in javascript

    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:
    Code:
    <script language="JavaScript">
    document.writeln("<B>history:</B> " + history);
    </script>
    That tells me its an object, which I know so I try:
    Code:
    <script language="JavaScript">
    document.writeln("<B>history:</B> " + history[0]);
    </script>
    Which gives me nothing... Any help?
    -bubbles

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    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.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    If the browser supports Netscape signed scripts ( such as Firefox ), then just place the following line before your code to invoke the security manager :

    Code:
    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.

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Doesn't that require a signed script?
    http://www.mozilla.org/projects/secu...d-scripts.html

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

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    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.

  • #6
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Ah, gotcha.
    Generally speaking, I don't allow anything to run if the browser had to ask me about it in the first place.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •