NAVIGATION:

 

SUPPORTERS:

FlashComponents
  Flash Templates
  Flash Gallery
  Flash Slideshow
  Flash Menu
  Flash Design
  Flash Video
  User Interface

 

FOLLOW:

RSS it down! Twitter it up! Facebook it like a fiend!

 

 

 

 

 
Add
to Favorites Link
         by kirupa chinnathambi

A popular feature you see on various sites is a link that allows you to bookmark their pages to your favorites. The following is an example of a link, when clicked, prompts you to add this page to your favorites:

The Code:

javascript:window.external.AddFavorite(location.href, document.title);

The simplest way of implementing the JavaScript code would be to include it in a hyperlink. Copy and paste the following code into Notepad or your HTML editor and preview the page in your browser:

Basically, if you know how to create a hyperlink to a different page, you will be able to create a Add to Favorites link. There are a few simple characteristics that you should take note of:

  • location.href
    This parameter gets the full URL of the current page.
     

  • document.title
    This parameter takes note of the current page's title that will be used as your Favorites title.

The code I mentioned above works on any page and requires very little customization. The code will automatically determine the title of your page and the correct URL with no input required from you. There are, however, times when you do not want to have the current page's title and location added to your favorites. You may want to specify a specific page title and URL instead.

For such situations, use the following code instead:

javascript:window.external.AddFavorite('http://www.kirupa.com', 'kirupa.com')

The above code is very similar to the code posted earlier. The only difference is that the location.href and document.title parameters have been replaced with actual values that are independent of the page you are currently in.

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 
Cheers!
Kirupa Chinnathambi
kirupaBlog

 

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components Flash effects. Art without coding.
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Citrus Engine: Flash platformer and sidescrolling game engine
Learn how to advertise on kirupa.com

cdn
content delivery network (cdn)