SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up javascript bookmark / favorite issue.

    I'm trying to make a book mark button the following is what I have.
    It shows the alert, but bookmark nothing.
    (I'm using Mac.)


    HTML Code:
    function bookmark(title, url){
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
    
    window.external.AddFavorite(url,title);
    alert("IE: bookmarked");
    }
    else if(navigator.appName == "Netscape"){
    alert("NETSCAPE: NOT SUPPORTED");
    }else{
    alert("NOT SUPPORTED");
    	}
    }
    
    
     <a href="javascript:bookmark('My title','My url');">Click to Bookmark</a>
    When I use the following in function, nothing happens.


    if (window.sidebar) {
    window.sidebar.addPanel(title, url);
    } else if( window.external ) {
    window.external.AddFavorite( url, title);
    }

    Can you help me?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    See http://javascript.about.com/library/blufav.htm for a script that I wrote that works as well as possible on all the browsers that support that function.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •