The following javascript code snippet allows a user to add your page as homepage, and to bookmark (favorite) your page.
The following javascript function code allows you to add the current address location as the Homepage of your browser.
But there is another option available though not javascript. The addthis site provides you with a custom button that can be added to your site/blog, that not only allows to bookmark your page but also provides you with data related to how and where the content is being shared.
You can download the entire code from here.
The following javascript function code allows you to add the current address location as the Homepage of your browser.
function setHome()The following javascript function code adds the current address location to your browser’s Bookmarks list, and the document title is set as the title (name) of the Bookmark.
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(window.location.href);
}
function setBookmark()The problem with the above codes is that the ‘Homepage’ code works only in Internet Explorer, and the ‘Bookmark’ code is somewhat erry in Firefox (bookmarked page opens in sidebar).
{
var title = document.title;
var address = window.location.href;
if(window.sidebar)
{
window.sidebar.addPanel(title,address);
}
else if(window.external)
{
window.external.AddFavorite(address,title);
}
else if(window.opera && window.print)
{
var elem = document.createElement('a');
elem.setAttribute('href',address);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
}
But there is another option available though not javascript. The addthis site provides you with a custom button that can be added to your site/blog, that not only allows to bookmark your page but also provides you with data related to how and where the content is being shared.
You can download the entire code from here.
0 comments:
Post a Comment