The Ultimate Add Bookmark Script

Guide your visitors in adding your page as a bookmark (aka favorite) in their browser with this cross-browser, cross-platform script.


How To Get The Script

You can download the jQuery version of the script here.
(jQuery needs to be loaded into the page before this script.)

You can download the plain version of the script here.

Purchase Commercial License

Show Your Appreciation By Donating $5

Non-Commercial users may show their appreciation by making a small $5 donation. Whether you do or not, I hope you find the script useful.

How To Use The Script

The script looks for an element with the ID attribute set to "addBookmarkContainer" and appends a new link (<a>) element as a child of it. The following code is an example of the elements needed to use this script on a page (change the path as needed).

<script type="text/javascript" src="/js/add_bookmark.js">
<p id="addBookmarkContainer"></p>

Would you like assistance in installing this script? If so, please contact us.


The script has been updated to be compatible with IE11.

I've added code to detect mobile devices and disable this script in them, since this script is meant for desktop browsers. To support mobile devices I would need to be given information on the support each device does or does not provide for features needed for use in this script.

What Makes This Script Different?

This script is written using unobtrusive JavaScript (JS) techniques so that if JS support is not enabled, the link will not be present, thus preventing confusion in any user (of a browser that does not have JS support enabled) who clicks the link with no result.

Another big difference is that it is made to do something useful in more browsers than just IE/Win, Firefox, and/or Opera 7+. It is known to work (to varying degrees) in IE5+/Win, Firefox, Safari, Google Chrome (for Windows), Opera 7+, Konqueror 3+, IE5/Mac, and iCab 3.

Many similar scripts use window.sidebar.addPanel() or rel="sidebar" to add a bookmark in Firefox. There's just one problem with those two methods — they add a bookmark that is set to open in the sidebar (panel) by default instead of opening in the window/tab like a normal bookmark. rel="sidebar" works fine in Opera 7+, because in the dialog window there is an option to make the bookmark open in the sidebar or not. Firefox doesn't provide that option in the dialog window; to change it you have to open the properties of the bookmark, which most people won't be aware of or know how to do.

Known IE Issue

When the page is viewed directly from Windows, there's a security limitation on the function used in IE that triggers an error which causes the page to reload. I could add code to prevent the error, but since the script will always be used on a web server, it doesn't seem worth making the script longer to fix it.

Last update: 2013-09-30