Add to favorites/bookmarks in Internet Explorer and Firefox

With only a few JavaScript lines you can initiate the dialog for "Add to Favorites" dialog in Internet Explorer and the "Add to Bookmarks" dialog in Firefox, as shown in this example.
  1. <script type=“text/javascript”>
  2. var BookmarkURL=“http://www.geekpedia.com”
  3. var BookmarkTitle=“Geekpedia”
  4. // If the browser is Internet Explorer
  5. if (document.all)
  6. {
  7.  // Add to Favorites (Internet Explorer)
  8.         window.external.AddFavorite(BookmarkURL,BookmarkTitle)
  9. }
  10. else
  11. {
  12.  // Add to Bookmarks (Mozilla Firefox)
  13.         window.sidebar.addPanel(BookmarkTitle, BookmarkURL, ”);
  14. }
  15. </script>

Leave a Reply

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

Back To Top