JS compatible Firefox IE Favorites Set homepage code
Source: Internet
Author: User
Add to Favorites
function Addcookie (URL, title) {
if (document.all) {
Window.external.addFavorite (URL, title);
}
else if (Window.sidebar) {
Window.sidebar.addPanel (title, URL, "");
}
}
Set as homepage
function setHomePage (URL) {
if (document.all) {
Document.body.style.behavior= ' url (#default #homepage) ';
Document.body.setHomePage (URL);
}
else if (Window.sidebar) {
if (Window.netscape) {
try{
Netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect");
}
catch (e) {
Alert ("Your browser does not enable [set as homepage] feature, open method: First enter About:config in the Address bar, then the item Signed.applets.codebase_principal_support value should be true");
}
}
var prefs=components.classes[' @mozilla. Org/preferences-service;1 '].getservice ( Components.interfaces.nsIPrefBranch);
Prefs.setcharpref (' browser.startup.homepage ', url);
}
}
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.