SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript add bookmark

    Hello everyone,

    I was hoping to get some help on adding a bookmark us link to my page. I want to have the code come from an external .js page but not sure on how to call the code from the actual link itself?

    I know how to add the code to call the file but what about the actual tag itself where the "Bookmark Us" text is?

    Also will this script work across all browsers?

    var bookmarkurl="http://mysite.com"
    var bookmarktitle="Site title"

    function addbookmark(){
    if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
    }

    Thank You

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    HTML Code:
    <a href="#" onclick="addbookmark()">Bookmark</a>
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also will this script work across all browsers?
    The following if conditional:

    if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)

    is an IE test. So, the answer is no.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    would you please be able to point me to a script that does work across browsers?

  5. #5
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I think that IE is the only browser which support this.
    ERIK RIKLUND :: Yes, I've been gone quite a while.


Bookmarks

Posting Permissions

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