Friday, January 2, 2009

Javascript to Bookmark a website!

Here is a javascript function to bookmark any website:
Usage:
javascript:bookmark('http://sandeep-aparajit.blogspot.com', 'Sandeep Aparajit Blogs');


<script type="text/javascript">
function bookmark(url,title)
{
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
{
window.external.AddFavorite(url,title);
}
else if (navigator.appName == "Netscape")
{
window.sidebar.addPanel(title,url,"");
}
else
{
alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
}
}
</script>

Hope this helps :)

0 comments:

Post a Comment