Why only can Add to Favorites for IE Bookmark but not FF?

Discussion in 'JavaScript' started by JJnacy, Jun 12, 2009.

  1. #1
    I need the code can add to Favorites IE and Firefox bookmarks.

    I have this one but only work for IE.
    <a href="javascript:window.external.addFavorite('http://URL/','Title')">
    <font>Add the site to favor links (bookmark)</font></a>


    How to write for IE and FF?


    Thanks
     
    JJnacy, Jun 12, 2009 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    hi
    <head>
    <script language="javascript">
    <!--
    function bookmarksite(title,url){
    if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
    }
    else if(document.all)// ie
    window.external.AddFavorite(url, title);
    }
    -->

    </script>


    </head>

    <body>
    <!-- Donot change anything Above this Line,only change is description and url in the function given below -->
    <a class="pdfbycat" href="javascript:bookmarksite('discription for bookmark', url')">Bookmark Us</a>
     
    kmap, Jun 12, 2009 IP
    JJnacy likes this.