
It's strange... but when I searched for the js snippet for this functionality I either got out-of-date javascript snippets that don't work anywhere else except IE 5 (I guess) or strange monsters that allow to save current page anywhere except browser itself!
The first solution that was more or less useful was the AddThis site that allows you to get snippet from their site. Everything you need is to select the style of the button and copy&paste snippet to you page. And you'll get something like this:
![]()
You know... I don't like features like that (those that take content from some thirdparty sites or servers). I just need a link and it should work always when my site is up and running. Also for those who beleive in conspiracy theory - I think that this module also gathers statistics about your site the same way as google analytics does. Otherwise - why do they give this feature for free?
So I searched again and found jQuery plugin that works the same way as above one but at least I know where it is placed and what it does. It's easy to implement (as always in jQuery) and it gives a lot of sites where I can share this page, but.... it doesn't allow to bookmark your page in current browser!
Fortunately, after several more hours of searching I found what I wanted. Hope it will be useful for you too.
Do you want to add this page to your bookmarks? :)
<script type="text/javascript">
$(document).ready(function(){
// add a "rel" attrib for Opera 7+
if(window.opera) {
if ($("a.bookmark").attr("rel") != ""){
$("a.bookmark").attr("rel","sidebar");
}
}
$("a.bookmark").click(function(event){
event.preventDefault();
var url = this.href;
var title = this.title;
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title);
} else if(window.opera) { // Opera 7+
return false; // do nothing
} else {
alert('Unfortunately, this browser does not support the requested action, please bookmark this page manually.');
}
});
});
</script>
Comments
Post new comment