Bookmark Site Script - Easy to use

Discussion in 'HTML & Website Design' started by glitto, Mar 8, 2008.

  1. #1
    I was searching for this script and when I found it (after much time spending) I thought I should share it to make it easy for others

    Here are the steps to follow.

    Step 1: Add the code given below in the <head> section of your website.

    <script type="text/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>

    Step 2: Create an image or text link and for the href attribute use this code

    javascript:bookmarksite('title_of_site', 'url_of_site')

    Example:
    <a href="javascript:bookmarksite('SmartPixels', 'http://www.smartpixels.net')">Bookmark this site!</a>

    And you are done! :)

    Try it now.
     
    glitto, Mar 8, 2008 IP
  2. NETeDEALS

    NETeDEALS Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just tried it. Very nice.
     
    NETeDEALS, Mar 8, 2008 IP
  3. glitto

    glitto Notable Member

    Messages:
    2,839
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    205
    #3
    great, I am happy I helped someone :)
     
    glitto, Mar 8, 2008 IP
  4. glitto

    glitto Notable Member

    Messages:
    2,839
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    205
    #4
    By the way, is there any way to know how many people have bookmarked our site?

    If so please share.
     
    glitto, Mar 8, 2008 IP