Adding links to favourites?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Adding links to favourites?

Post by alex.barylski »

This used to be possible in JavaScript -- I know it cause I did it close to 10 years ago. Obviously times have changed and when I google for demos none of them work. :P

I am trying to offer a link to a business on my page but optionally have that link prompt the user to create a favourite bookmark in their browser. Is this still possible?

These are links which are not the active page -- so emulating a ctrl+D won't work -- I don't want the active page bookmarked...

jQuery plugin??? :P

Cheers,
Alex
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Adding links to favourites?

Post by Benjamin »

Here's some code I wrote about 5 years ago to do this. Not sure if it's outdated or not:

Code: Select all

 
<script type="text/javascript">
<!--
function addToFavorites() {
  if (window.external) {
    window.external.AddFavorite(location.href,document.title)
  } else {
    alert("Your browser doesn't support this function.\n\n  Please click OK, then press CTRL and the letter D at the same time to add this page to your favorites list manually.\n\n  If you are using the Opera browser, use CTRL and T.\n\n  Thank you for visiting!");
  }
}
 
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Adding links to favourites?

Post by John Cartwright »

I believe windows.external is for IE only. A quick google reveals this jquery plugin.
Post Reply