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.

Features

  • 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.

Preview

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

Downloads

Note:
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 hscripts.com-->
<!-- more scripts @ http://www.hscripts.com -->
<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;
if(document.layers)
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;
}else{
pwidth = window.innerWidth;
pheight = window.innerHeight;
stop = window.pageYOffset;
sleft = window.pageXOffset;
}
var dda = document.getElementById('ddd');
if(corner == "topleft"){
dda.style.top = (stop)+"px";
dda.style.left = (sleft+15)+"px";
}else if(corner == "topright"){
dda.style.top = (stop)+"px";
dda.style.left = (sleft+pwidth-110)+"px";
}else if(corner == "bottomleft"){
dda.style.top = (stop+pheight-45)+"px";
dda.style.left = (sleft+15)+"px";
}else if(corner == "bottomright"){
dda.style.top = (stop+pheight-40)+"px";
dda.style.left = (sleft+pwidth-110)+"px";
}
setTimeout('run()',5);
}
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('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();}else if(os == "ie")
{
window.external.AddFavorite(url,title);
}
else
{alert('Press CTRL + D to bookmarksad this page.');
}
}
document.onload = run();
</script>
<!-- Script by hscripts.com -->



  • 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 $5/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • 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.

License

  • The javascript (misspelled as java script) is given under GPL License.
  • i.e. Free use for those who use it as it is.
  • Free, if your modification does not remove our copyright information and links.
  • Detailed License information can be found here.
  • You can purchase the script if your requirements does not meet GPL License terms.

Free Javascript Scripts