/**
* 设为主页
* @param obj 参数为this
*/
function SetHome(obj) {
try {
var url = window.location.href; //获取当前url地址
obj.style.behavior = 'url(#default#homepage)';
obj.setHomePage(url);
} catch (e) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager
.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
}
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', vrl);
}
}
}
/**
* 收藏本页
*/
function addFavorite(){
var url = window.location.href; //获取当前url地址
var title = document.title; //获取当前网站标题
try {
window.external.addFavorite(url, title);
} catch (e) {
try {
window.sidebar.addPanel(title, url, "");
} catch (e) {
alert("加入收藏失败,请手动添加.");
}
}
}

相关文章:

  • 2022-12-23
  • 2021-09-17
  • 2021-05-28
  • 2022-12-23
  • 2022-02-14
  • 2021-09-26
  • 2022-12-23
  • 2021-05-31
猜你喜欢
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-07-31
  • 2021-08-02
相关资源
相似解决方案