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.

What's wrong with this bookmark script?

Discussion in 'JavaScript' started by Space Goat, Oct 5, 2005.

  1. #1
    I use this script to allow people to add a site to their bookmarks by clicking a link:

    function addBookmark(title,url) {
    if (window.sidebar) { 
    window.sidebar.addPanel(title, url,""); 
    } else if( document.all ) {
    window.external.AddFavorite( url, title);
    } else if( window.opera && window.print ) {
    return true;
    }
    }
    Code (markup):
    Here is an example of how I call it:

    <a href="javascript:addBookmark('Hypersyllogistic: Partisanship Rehab', 'http://www.hypersyllogistic.com')" title="Add Hypersyllogistic to your favorites">Bookmark Hypersyllogistic</a>
    Code (markup):
    My problem is, even though this script was purported to work with Internet Explorer as well as Firefox, it only works with the latter and not the former. In Internet Explorer, clicking on a link to add a bookmark makes the status bar say, "Errors on page."

    (The peculiar thing is, I remember this script working in IE for me before. :confused: )

    How can I make the script work in both IE and Firefox?
     
    Space Goat, Oct 5, 2005 IP
  2. Neoto

    Neoto Active Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #2
    Hmm... I tried your script on my computer and it worked fine with both IE and Firefox. Here's the page I tested with:

    
    <html>
      <head>
        <script type="text/javascript">
        <!--
    function addBookmark(title,url) {
    	if (window.sidebar) { 
    		window.sidebar.addPanel(title, url,""); 
    	} else if( document.all ) {
    		window.external.AddFavorite( url, title);
    	} else if( window.opera && window.print ) {
    		return true;
    	}
    }
    -->
        </script>
      </head>
      <body>
        <a href="javascript:addBookmark('Hypersyllogistic: Partisanship Rehab', 'http://www.hypersyllogistic.com')" title="Add Hypersyllogistic to your favorites">Bookmark Hypersyllogistic</a>
      </body>
    </html>
    
    Code (markup):
    Does this work on your computer?
     
    Neoto, Oct 6, 2005 IP
  3. Space Goat

    Space Goat Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It works on my computer. But it doesn't work when I load my web site. :confused:
     
    Space Goat, Oct 6, 2005 IP
  4. Neoto

    Neoto Active Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #4
    That's really odd... The only thing that I can think of is that there is a proxy, between your computer and the server hosting the files, that strips or modifies the javascript somehow.
     
    Neoto, Oct 7, 2005 IP
  5. WhatiFind

    WhatiFind offline

    Messages:
    1,789
    Likes Received:
    257
    Best Answers:
    0
    Trophy Points:
    180
    #5
    I'm using this:
    var url = this.location;
    var title = document.title;
    
    function makeLink(){
    if(document.all)
    window.external.AddFavorite(url,title)
    }
    Code (markup):
    Then call the script with this code in href:
    javascript:makeLink()
    Code (markup):
    Works really well.
     
    WhatiFind, Oct 7, 2005 IP
  6. liwei

    liwei Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Does this work with netscape also?
     
    liwei, Oct 30, 2005 IP
  7. wakeup

    wakeup Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7

    I'm trying it, and it do bookmark in firefox, but it is opened in the sidepanel :(
     
    wakeup, Dec 10, 2005 IP
  8. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #8
    I took Neoto script and uploaded it. I does not work on local but it work
    and i made a test page


    I am looking for a Short Cut to your desktop and Make this your start page script if some one have.
     
    TheSyndicate, Dec 21, 2005 IP