WEB code to add a favorite in Firefox

Discussion in 'OT Technology' started by Falconer, Nov 24, 2008.

  1. Falconer

    Falconer OT Supporter

    Joined:
    Jun 23, 2006
    Messages:
    65,506
    Likes Received:
    1
    So I got this code, which was working perfectly in IE, but in FF it was opening it in a side panel:

    Code:
    function Bookmark()
    {
        if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
            window.external.AddFavorite("URL","site name");
        } else if (navigator.appName == "Netscape") {
            window.sidebar.addPanel("URL","http://URL/","");
        } else {
            alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
        }
    }
    And then in the page text I have this:

    Code:
     <a href="javascript:Bookmark()">bookmark 
                this site</a> 
    So I assumed it was because the Netscape code said to do this: window.sidebar.addPanel

    Alright so I don't want that, so I changed it to match what the IE one said, window.external.AddFavorite, but now when you click the "add to favorites" link, nothing happens.

    So, what is the correct code to add a normal bookmark in Firefox?

    Thanks.
     
  2. RetardedMonkey

    RetardedMonkey is a retarded monkey.

    Joined:
    Oct 21, 2006
    Messages:
    20,867
    Likes Received:
    0
    Location:
    Gold Coast, Australia
    Javascript across browsers is such a pain in the ass :hs:
     
  3. Falconer

    Falconer OT Supporter

    Joined:
    Jun 23, 2006
    Messages:
    65,506
    Likes Received:
    1
    Is there a way to "add to favorites" without using Javascript?
     
  4. Falconer

    Falconer OT Supporter

    Joined:
    Jun 23, 2006
    Messages:
    65,506
    Likes Received:
    1
    i searched w3schools and didn't find anything. I thought there was a simple html code to add a bookmark, like <a: bookmark "www.yourwebsite"> or something.
     

Share This Page