(+84) 463.28.7979

How to add your site to bookmarks


If you want to create a link in your HTML page for adding your site to Bookmarks you should add the following code to the <head> section:

<script type=”text/javascript”>/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, “”);
else if(window.opera && window.print){ // opera
var elem = document.createElement(‘a’);
elem.setAttribute(‘href’,url);
elem.setAttribute(‘title’,title);
elem.setAttribute(‘rel’,’sidebar’);
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}
</script>

After that create either an image or text link that will be used as the Bookmark Site link. For the href attribute, you should use the code below:

javascript:bookmarksite(‘title_of_site’, ‘url_of_site’)

For example:

<a href=”javascript:bookmarksite(‘My Site’, ‘http://www.mysite.com’)”>Add this site to your bookmarks</a>

Note! If your site’s title contains apostrophes, they need to be backslashed when entered:

<a href=”javascript:bookmarksite(‘David\’s Photo Portfolio’, ‘http://www.mysite.com’)”>Add this site to your bookmarks</a>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>