Dynamic Drive DHTML code library!
Dynamicdrive.com


.
spacer.gif (807 bytes)
Featured Script
Trembling text 
Make select text on your page "shiver" slightly to draw attention to them!
.
Market Place 
Coders, sell Your programming skills online. 100's of projects available today.
.
Site Info
Search DD
Recommend DD
Email offers
Awards
DHTML Books
Advertising
Contact
.
Site Partners
Free JavaScripts
Free Graphics
.
Link to DD
Do you use scripts from Dynamic Drive? Please give something back by linking to us...
.
spacer.gif (807 bytes)

Home Small4.gif (1046 bytes) User and System Preference Small4.gif (1046 bytes) Here

Add-to-Favorites Script IE

Credits:
Contributor name: David Gardner
Homepage: N/A

Description: If you've been looking all over the web for a script that allows your surfers to easily add your site to their bookmark (favorites) list in IE, well, your search is over. The below script creates a link that, when clicked on, adds the specified page to the surfer's bookmark list.

Demo: (You can use either an image link or a regular text link)

Click here to instantly bookmark Dynamic Drive!


Directions: Developer's View

Step 1: Add the below code to the <head> section of your page:


Step 2: Create either an image or text link that will be used as the add-to-favorites link. For the href attribute, use the following code:

javascript:addbookmark()

Here's an example:

<a href="javascript:addbookmark()">Bookmark this site!</a>

Since this script only functions in IE 4+, you may wish to hide it from other browsers by dynamically writing out the link. The easiest way to do that is to first use the document.all object to sniff out IE 4 users, then use the document.write() method to write out the link only for them. For example:

<script>
//if the user is using IE 4+
if (document.all)
document.write('<a href="javascript:addbookmark()">Bookmark this site!</a>')
</script>

It's up to you, though, on how exactly you want to do it.

Recommend Us!
-If you like Dynamic Drive, please recommend us to a friend...

Partner
Merchant Select
Enable e-commerce on your site and more. Visit the Merchant Select directory today!

Legend
All- Script works with Netscape 4 AND Internet Explorer 4+
NS- Indicates script works with Netscape 4 (NOT NS 6 yet)
IE- Indicates script works with Internet Explorer 4 and above
IE5- Indicates script works with Internet Explorer 5 and above
NS6!- Temporary index set up on script category pages to indicate script works in NS6


Copyright � 1998-2001 Dynamic Drive. Please read Terms Of Use here before using any of the scripts.

Hosted by www.Geocities.ws

1