Javascript compatible with IE6, IE7, and FF, "add to Favorites" and "set as Homepage"
Source: Internet
Author: User
Add the following code to the Internet Explorer 6 and Internet Explorer 7: window. external. addFavorite (sURL, sTitle); note: the first letter a of addFavorite is not in uppercase! Even if Microsoft uses uppercase letters for reference, it is better than words. Add to favorites code for Firefox: method 1, & lt; ahref & quot; http... IE6, and IE7 add to favorites code:
Window. external. addFavorite (sURL, sTitle );
Note:
The first letter a of addFavorite is not capital! Even if Microsoft uses uppercase letters for reference, it is "better than words ".
Add to favorites code in Firefox:
Method 1,
Add to favorites
The key lies in rel = "sidebar"; the href attribute value is used as the favorite URL; and the title is used as the favorite name.
Method 2,
Window. sidebar. addPanel (sTitle, sURL ,"");
The first parameter is the favorite name, the second parameter is the favorite URL, and the third parameter is the URL required for custom Tab, which is a string of zero length. Note that the parameter order is different from addFavorite. We recommend the second method.
No matter which method, after adding to favorites, you can click the favorites item to open the webpage in the sidebar. There are only two ways to open the webpage in the main window: Right-click to open the webpage; method 2: Right-click to modify its attributes. This is a pity for Firefox favorites.
Full code compatible with "add to Favorites" of IE6, IE7, and FF:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.