AddFavorite method (external)
Displays the 'Add a Favorite' dialog box for the specified URL and title in Internet Explorer.
Use the addPanel method for similar functionality in Firefox.
Opera, Google Chrome and Safari do not provide a way to add new elements to the Favorites (Bookmarks) from JavaScript.
Syntax:
You can find the related objects in the Supported by objects section below.
Parameters:
Required. String that specifies the URL of the page that you want to add to the favorites. | |||||||
Optional. String that specifies the name of the page that you want to add to the favorites. |
Return value:
This method has no return value.
Example HTML code 1:
This example shows how to add a page to the Favorites (Bookmarks) in Internet Explorer and Firefox.
|
||||
<head> <script type="text/javascript"> function AddToFavorites () { if (window.sidebar) { // Firefox window.sidebar.addPanel ('Dottoro help page', 'http://help.dottoro.com', ''); } else { if (window.external && ('AddFavorite' in window.external)) { // Internet Explorer window.external.AddFavorite ('http://help.dottoro.com', 'Dottoro help page'); } else { // Opera, Google Chrome and Safari alert ("Your browser doesn't support this example!"); } } } </script> </head> <body> <button onclick="AddToFavorites ();">Add to favorites</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments