Simple Bookmark Script using jQuery

0

Introduction:

Below is the simple Bookmark script, which has been implemented using jQuery, this might help most of the people to bookmark your respective webpages / blogs. I have tested the application in Mozilla Firefox (Latest Version – 3.0.10), IE 7 & 8, Google Chrome. Simple code to understand and to implement, I am sure its going to help most of the people to save your website / blog url to their favorites. For this to achieve we need jQuery library file, so please download the same from jQuery Site that is http://www.jquery.com

jQuery Code:

<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("a.jQueryBookmark").click(function(e){
e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
var bookmarkUrl = this.href;
var bookmarkTitle = this.title;

if (window.sidebar) { // For Mozilla Firefox Bookmark
window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
} else if( window.external || document.all) { // For IE Favorite
window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
} else if(window.opera) { // For Opera Browsers
$("a.jQueryBookmark").attr("href",bookmarkUrl);
$("a.jQueryBookmark").attr("title",bookmarkTitle);
$("a.jQueryBookmark").attr("rel","sidebar");
} else { // for other browsers which does not support
alert('Your browser does not support this bookmark action');
return false;
}
});
});
</script>

HTML Code


<h2>Click on the respective links below to bookmark the same</h2>
<a href="http://www.tailoc.net" title="tailoc.net" class="jQueryBookmark">Website Design</a>
Labels:
Loading related posts...
Reactions: 

0 comments:

Post a Comment

2010 WEBSITE20. All rights reserved.