zoukankan      html  css  js  c++  java
  • js加入收藏

    function addFavorite2() {
        var url = window.location;
        var title = document.title;
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf("360se") > -1) {
            alert("由于360浏览器功能限制,请按 Ctrl+D 手动收藏!");
        }
        else if (ua.indexOf("msie 8") > -1) {
            window.external.AddToFavoritesBar(url, title); //IE8
        }
        else if (document.all) {
      try{
       window.external.addFavorite(url, title);
      }catch(e){
       alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
      }
        }
        else if (window.sidebar) {
            window.sidebar.addPanel(title, url, "");
        }
        else {
      alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
        }
    }

    <a href=# onclick="javascript:addFavorite2()">加入收藏</a>

    注:内容来源于网络

  • 相关阅读:
    c++类中比较重要的几个函数
    rosbag使用方法
    2.urllib库的使用
    什么叫做API?
    1.爬虫基础
    正则表达式

    time模块
    random模块
    日志处理
  • 原文地址:https://www.cnblogs.com/NigelShi/p/4597289.html
Copyright © 2011-2022 走看看