Friday, June 18, 2010

How to add a Bookmark to the Browser using Javascript

Adding a Bookmark to the Browser using Javascript

function Add_Bookmark_Favorite(url,title) 
        {
         if (window.sidebar) 
         { // Mozilla Firefox Bookmark
             //Make sure "Load this bookmark in the sidebar is deselected
          window.sidebar.addPanel(title, url,"");
          return false;
         } 
         else if( window.external ) 
         { // IE Favorites
          window.external.AddFavorite( url, title); 
          return false;
         }
         else if(window.opera && window.print) 
         { // Opera Bookmark
                return !addToFav(url,title)
            }
        }

url -----> URL is the site which we want to make the site as a Bookmark
title ------> Title for the site given in the Bookmark

JavaScript: The Good Parts JavaScript: The Definitive Guide Professional JavaScript for Web Developers (Wrox Programmer to Programmer) Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide) 

No comments: