1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to create a "Bookmark this site" Button ?

Discussion in 'JavaScript' started by poseidon, Jan 22, 2006.

  1. #1
    Hi,

    I want to create a button(standard one- submit or clear type) on which when a user click for bookmarking the page. Having the button is important part.

    Regards
    SEMrush
     
    poseidon, Jan 22, 2006 IP
    SEMrush
  2. kurtsfar

    kurtsfar Guest

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Put something like this within the head
    section of your HTML document, or better yet, skip the script tags and
    put it in an external file and link to it in the head section instead:



    <script language="JavaScript" type="Text/Javascript">
    <!-- // 
    var url = "http://www.webpelican.com/internet-programming-3/"; 
    var pageName = "Client side programming"; 
    function bookmark() { 
    if (window.external) { 
    window.external.AddFavorite(url, pageName)   
    } 
    else { 
    alert("Sorry! Your browser doesn't support function. 
    Use the bookmark option in your browser instead."); 
    } 
    } // --></script>
    Code (markup):
    And this somewhere in the body section of your HTML document:
    Button:
    <input type="button" name="Bookmark this page" onclick="bookmark()" />

    or...

    Simple link:
    <a
    href="javascript:bookmark()">Click here to bookmark this page
    </a>

    (and of course change the URL to whatever URL you would like to bookmark:) )
     
    kurtsfar, Jan 24, 2006 IP
  3. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks..let me check it....and one more thing, as far as putting code in a file is concerned, how can I include that file ? should it be a .js file ?
     
    poseidon, Jan 25, 2006 IP
  4. kurtsfar

    kurtsfar Guest

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <script src="/myExternalJavaScript.js" type="text/javascript"></script>


    should can be put at the end of the body(within the body's start and end tag)
    if it is important to the functionality of the script that all the document elements have loaded.

    Otherwise it can be put at the end of the head section.


    I'm by no means a guru in this area since I usually don't do much client side scripting.

    However, I have done some probably not to great JavaScript coding. The code is open to view and/or download.
    Below is one example. You can download the file at the bottom of the page.
    Then link to it as described above.
    When you tried that, there shouldn't be a problem doing your own scripts.
    DOM Properties, JavaScript

    Give it a try
     
    kurtsfar, Jan 26, 2006 IP
  5. reksss

    reksss Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi
    Tell me which sites have beautiful bookmark to install to your website? thank you
     
    reksss, May 12, 2012 IP
  6. michaelhomas83

    michaelhomas83 Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #6
    here is code for bookmark
    <script Type="text/javascript">
    /* Modified To support Opera */
    function bookmark(title,url){
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    url =url+sPage;
    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>
     
    michaelhomas83, May 29, 2012 IP
  7. Unni krishnan

    Unni krishnan Peon

    Messages:
    237
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    0
    #7
    A detailed tutorial can be find from here.
    Boomark a Page

    Also add-this is a good-option that allows bookmarking, social sharing and much more.
     
    Unni krishnan, Jun 27, 2012 IP