You are here: Reference > JavaScript > client-side > browser > methods > AddFavorite (external)

AddFavorite method (external)

Browser support:
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.


object.AddFavorite (URL [, title]);
You can find the related objects in the Supported by objects section below.


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.
    <script type="text/javascript">
        function AddToFavorites () {
            if (window.sidebar) {        // Firefox
                window.sidebar.addPanel ('Dottoro help page', '', '');
            else {
                if (window.external && ('AddFavorite' in window.external)) {
                        // Internet Explorer
                    window.external.AddFavorite ('', 'Dottoro help page');
                else {  // Opera, Google Chrome and Safari
                    alert ("Your browser doesn't support this example!");
    <button onclick="AddToFavorites ();">Add to favorites</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content