• 设为主页加入收藏


     1     //加入收藏
     2     function addFavorite() {
     3         if (document.all) {
     4             try {
     5                 window.external.addFavorite(window.location.href, document.title);
     6             } catch (e) {
     7                 alert("加入收藏失败,请使用Ctrl+D进行添加");
     8             }
     9         } else if (window.sidebar) {
    10             window.sidebar.addPanel(document.title, window.location.href, "");
    11         } else {
    12             alert("加入收藏失败,请使用Ctrl+D进行添加");
    13         }
    14     }
    15 
    16     //设为主页
    17     function setHomepage() {
    18         if (document.all) {
    19             document.body.style.behavior = 'url(#default#homepage)';
    20             document.body.setHomePage(window.location.href);
    21         } else if (window.sidebar) {
    22             if (window.netscape) {
    23                 try {
    24                     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    25                 } catch (e) {
    26                     alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
    27                 }
    28             }
    29             var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage', window.location.href);
    30         } else {
    31             alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');
    32         }
    33     }
  • 相关阅读:
    orm操作
    模板语言
    路由
    newlib中printf库函数的实现
    调试问题记录
    GCC部分编译选项解析
    Lauterbach TRACE32使用技巧记录
    ARM32 页表映射过程
    TTBR0与TTBR1
    Camera Sensor基础知识
  • 原文地址:https://www.cnblogs.com/xuejietong/p/8902247.html
Copyright © 2020-2023  润新知