JavaScript Bookmark

This script checks for internet explorer and what OS you are running. If Win/Mac and IE create link, If mac and No IE CMD -D and if win and No IE CTRL-D.

Also there is the option to Bookmark page or site… depends on what you want to bookmark! Just add this in your Body tags.

Add this snippet of code anywhere in your BODY tags or remove SCRIPT tags and paste into a new .JS file called bookmark.js and use <script src=“bookmark.js”></script> in BODY tag to call. By using includes you only have to update one file instead of every page if there is a change!

<script type="text/javascript">
	var BMurl = window.location;
	var  BMtitle = window.title;
	var msg= "Bookmark This Page";
 
if(navigator.appName == "Microsoft Internet Explorer"){
	document.write('<a href="javascript:window.external.AddFavorite(BMurl, BMtitle);">Bookmark This Page</a>'); 
}else if ((navigator.appname == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("Mac") != -1)){
	document.write('<a href="javascript:window.external.AddFavorite(BMurl, BMtitle);">Bookmark This Page</a>'); 
}else if ((navigator.appname != "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("Mac") != -1)){
	msg+= '<br/><font size="-4">Press (CMD-D) to Add</font>';
 	document.write(msg);
}else{
	msg += '<br/><font size="-4">Press (CTRL-D) to Add</font>';
	document.write(msg);
}						
</script>
 
development/javascript/bookmark.txt · Last modified: 2007/09/14 15:58 by vincenzobar
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki