Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The JavaScript FAQ
Prev Home Next

Bookmarks: Add Favorite

Question: How do I invoke the browser's Add Favorite dialog?

Answer: In Internet Explorer 4.0 and newer versions, you can invoke the browser's Add Favorite dialog by calling the method window.external.AddFavorite:
   window.external.AddFavorite('URL','bookmark text').
Netscape Navigator has no similar method (and no Add Favorite dialog at all). But your script can just remind Netscape users to create a bookmark by clicking using the Navigator menu or keyboard shortcut (see the example below).

Example: In Internet Explorer, this script creates a hyperlink that displays the Add Favorite dialog. In Netscape, the script reminds the user to create a bookmark by clicking Bookmarks | Add bookmark or press Ctrl+D.

Here's the source code of this example:
if (navigator.appName=="Netscape") {
 document.write (
   'To bookmark this site, click '
  +'<b>Bookmarks | Add bookmark</b> '
  +'or press <b>Ctrl+D</b>.'
 )
}
else if (parseInt(navigator.appVersion)>3) {
 document.write (''
  +'<a onMouseOver="self.status=\'Bookmark this site\'" '
  +' onMouseOut="self.status=\'\'" '
  +' href="javascript:window.external.AddFavorite'
  +'(\'https://www.JavaScripter.net/faq/\','
  +'\'JavaScripter.net FAQ\')">'
  +'Click here to bookmark this site</a>.'
 )
}

JavaScripter.net. Copyright © 1999-2006, Alexei Kourbatov

The JavaScript FAQ
Prev Home Next


 
 
  Mirrored with kind permission of Alexei Kourbatov Design by Interspire