Add To Favorites / Bookmark JavaScript

This free script will help the user to add their links to favorites. It helps the user to bookmark their page or else to add the page to their browser favorites, just by clicking an image/link on the page. After bookmarking, user can revisit a page from the list of bookmarks. This free javascript code can be used in any html page.


  • User can click the bookmark image/link to add the page to his browser favorites/bookmarks list.
  • Bookmark image or text will scroll along with the page.
  • You can place the link anywhere in your page.
  • This version of "Add to Favorites" works on IE, Firefox and Opera browsers.


Click the bookmark image which is on the bottom right corner of this page.


For book image to scroll instead of plain link - Right click and save the book image in to your folder.
Free JavaScript Bookmarks Code
<!--Script by>
<!-- more scripts @ -->
<script type="text/javascript">
//set the bookmark image position(topright,topleft,bottomright,bottomleft)
var corner = "topright";
var url = window.location;
var title = document.title;
document.write('<div id=ddd style="position: absolute; visibility: visible; top: 5px; left:5px;">'); document.write('<a style="font-size:14px; text-decoration: none;" href="javascript:bookmark(title, url)" title="click here to bookmark this page"><img src="hbookmark/book.gif" alt="Bookmark" border=0"><sup><span style="background-color:seashell; font-size:10px;">H</span></sup></a></div>');
var os;
os = "n4";
else if(document.getElementById&&!document.all)
os = "n6";
else if(document.all)
os = "ie";
function run()
if(os == "ie"){
pwidth = window.document.body.offsetWidth;
pheight = window.document.body.offsetHeight;
stop = document.body.scrollTop;
sleft = document.body.scrollLeft;
pwidth = window.innerWidth;
pheight = window.innerHeight;
stop = window.pageYOffset;
sleft = window.pageXOffset;
var dda = document.getElementById('ddd');
if(corner == "topleft"){ = (stop)+"px"; = (sleft+15)+"px";
}else if(corner == "topright"){ = (stop)+"px"; = (sleft+pwidth-110)+"px";
}else if(corner == "bottomleft"){ = (stop+pheight-45)+"px"; = (sleft+15)+"px";
}else if(corner == "bottomright"){ = (stop+pheight-40)+"px"; = (sleft+pwidth-110)+"px";
function bookmark(title,url){var ua = $.browser;if(window.sidebar){if (ua.version.slice(0,3)>22){alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');}else{window.sidebar.addPanel(title,url,"");}}else if(window.opera && window.print){
var elem = document.createElement('a');
elem.setAttribute('rel','sidebar');;}else if(os == "ie")
{alert('Press CTRL + D to bookmarksad this page.');
document.onload = run();
<!-- Script by -->

  • To use the Bookmark image, right click on the bookmark image and save it into your local disk.
  • To change the bookmark image position, just set the variable corner to any of the given values "topright,topleft,bottomright,bottomleft".[eg: var corner = "topleft";]

  • Release Date - 06-04-2007
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to


  • Copy the code in to your page.
  • Now right click on the image and save it in your local drive.
  • You can place the bookmark image either at topright/topleft/bottomright/bottomleft corner of the page just by changing the variable "corner".(eg: var corner = "topright";)
  • Ne: Use only the above mentioned keywords.
  • You can also use image to bookmark instead of using text link.
  • This free bookmarking JavaScript is tested in Windows IE, Firefox and Opera browsers.
  • Add your code under the comment to fit your requirement.


Related Scripts

Free Javascript Scripts

Ask Questions

Ask Question