Deprecated. Prompts the user with a dialog box to add the specified URL to the Favorites list.
Syntaxvar retval = external.AddFavorite(URL, Title);
- URL [in]
A String that specifies the URL of the favorite to add to the Favorites list.
- Title [in, optional]
Variant of type String that specifies the suggested title to use in the Favorites list. The user can change the title in the Add Favorite dialog box. If Title is not specified, URL is used as the title of the favorite.
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
There are no standards that apply here.
Calling the AddFavorite method prompts the user with the same dialog box that is displayed when the user selects Add to Favorites from the Favorites menu.
Because the Title parameter is used as a file name when storing the favorite, it cannot contain characters that have been reserved by the file system. If present, the following characters are removed from Title before the Add a Favorite dialog box appears.
- backslash (\)
- apostrophe (*)
- question mark (?)
- double quotation mark (")
- less than sign (<)
- greater than sign (>)
- pipe (|)
Additionally, slash marks (/) in Title are converted to hyphens (-), and leading and trailing spaces are trimmed. If no suitable characters are found in Title, the URL of the favorite is used instead.
If the favorites are stored on a drive that does not support long file names, only one dot (.) is allowed. Additionally, the title is trimmed to 8.3 and spaces are converted to hyphens.
This method is not supported in HTML Applications (HTAs).
Windows Internet Explorer 8 and later. For security reasons, the AddFavorite method must be called as a response to a user-initiated action, such a mouse click. If called from a different context, such as the onload event of the body element, the AddFavorite method fails silently.
This example uses the AddFavorite method to prompt a user to add the current page to the Favorites list. Because location.href is used, this script will succeed if served from a Web server using an allowed protocol, but fail with Permission Denied if run locally.
Build date: 11/21/2012