+ Reply to Thread
Results 1 to 6 of 6

Thread: Code for "Bookmark this page"...

  1. #1
    GEEK 2.0 blade is on a distinguished road blade's Avatar
    Join Date
    Jul 2006
    Location
    Ontario
    Posts
    417
    0 0

    Question Code for "Bookmark this page"...

    I need the javascript code that'll add your Website to a browsers favorites with a click of a button.

    This is the current code I use:
    <a href="javascript:window.external.AddFavorite('WEBS ITE', DESCRIPTION')">

    but there are 2 problems:

    1.) It only works for IE, I want one that'll work for Opera and Firefox as well; Safari too if possible

    2.) This code will only add the Website link you specified in the code. I want one that'll bookmark individual pages meaning people can bookmark the current page they're on instead of only being able to bookmark the Website you specified in the javascript code

  2. #2
    ehh...what's up, doc?
    RHochstenbach will become famous soon enough RHochstenbach's Avatar
    Join Date
    Nov 2006
    Location
    Limburg, Southern Netherlands
    Age
    21
    Posts
    2,261
    0 0

    Default Re: Code for "Bookmark this page"...

    Quote Originally Posted by blade View Post
    It only works for IE, I want one that'll work for Opera and Firefox as well; Safari too if possible
    Try the following script instead:
    Code:
    <script language="JavaScript1.2" type="text/javascript">
     function CreateBookmarkLink() {
    
     title = "Webpage Title"; 
      // Blogger - Replace with <$BlogItemTitle$> 
      // MovableType - Replace with <$MTEntryTitle$>
    
     url = "Webpage URL";
      // Blogger - Replace with <$BlogItemPermalinkURL$> 
      // MovableType - Replace with <$MTEntryPermalink$>
      // WordPress - <?php bloginfo('url'); ?>
    
    	if (window.sidebar) { // Mozilla Firefox Bookmark
    		window.sidebar.addPanel(title, url,"");
    	} else if( window.external ) { // IE Favorite
    		window.external.AddFavorite( url, title); }
    	else if(window.opera && window.print) { // Opera Hotlist
    		return true; }
     }
    
     if (window.external) {
      document.write('<a href = 
         "javascript:CreateBookmarkLink()");">Add to Favorites</a>'); 
      } else  if (window.sidebar) {
      document.write('<a href = 
        "javascript:CreateBookmarkLink()");">Bookmark Page</a>'); 
     } else if (window.opera && window.print) {	
       document.write('<a href =
         "javascript:CreateBookmarkLink()");">Add Bookmark</a>');
     } 
    </script>
    source
    TechLife Zone | My Blog | Twitter | Last.fm

    "There are only 10 types of people in the world - Those who understand binary, and those who don't."

  3. #3
    GEEK 2.0 blade is on a distinguished road blade's Avatar
    Join Date
    Jul 2006
    Location
    Ontario
    Posts
    417
    0 0

    Default Re: Code for "Bookmark this page"...

    what part of these do I replace...

    "// Blogger - Replace with <$BlogItemTitle$>"

  4. #4
    GEEK 2.0 blade is on a distinguished road blade's Avatar
    Join Date
    Jul 2006
    Location
    Ontario
    Posts
    417
    0 0

    Default Re: Code for "Bookmark this page"...

    this is only for blogger and wordpress man...

  5. #5
    Administrator Sniper is a jewel in the rough Sniper is a jewel in the rough Sniper is a jewel in the rough Sniper's Avatar
    Join Date
    Oct 2001
    Location
    Manchester, UK
    Age
    26
    Posts
    4,893
    0 0

    Default Re: Code for "Bookmark this page"...


  6. #6
    GEEK 2.0 blade is on a distinguished road blade's Avatar
    Join Date
    Jul 2006
    Location
    Ontario
    Posts
    417
    0 0

    Default Re: Code for "Bookmark this page"...

    worked for IE and Firefox, not Opera; thanks though

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Power Tree "S600B" UPS and Communication interface port
    By arunmir in forum Power Supplies and UPS's
    Replies: 1
    Last Post: 22-12-2006, 01:47 PM
  2. "input range out of signal" when booting to safe mode
    By JimBowen in forum Video Cards, Displays and TV Tuners
    Replies: 2
    Last Post: 30-08-2006, 02:30 PM
  3. Windows "Nightmare" Spurs Open-Source Adoption
    By Anti-Trend in forum News and Article Comments
    Replies: 1
    Last Post: 26-10-2005, 11:24 AM
  4. "Incorrect drive A type" error message - not reading a:
    By wobblywilly in forum Storage Devices
    Replies: 3
    Last Post: 04-02-2005, 09:17 AM
  5. PCtel HSP56 modem problem: "There is no dial tone".
    By _vibe in forum Networking and Computer Security
    Replies: 6
    Last Post: 01-11-2003, 09:26 AM

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