zoukankan      html  css  js  c++  java
  • 百度主动推送代码 批量改进版

    百度主动推送代码,批量推送页面所有URL。
    
    说明:改进修复推送undefined错误问题。
    <script type="text/javascript">
    //by https://www.jiansouti.com/
    var list = document.getElementsByTagName("a");
    var n = "http//api.share.baidu.com/s.gif";
    var ns = "https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif"; 
    var r = window.location.href;
    var url = [];
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
    for(var i=0;i<list.length;++i){
        if (typeof(list[i].href) != "undefined"){ 
        url.push(ns+'?l='+encodeURIComponent(list[i].href));
        }
    }
    } else {
    for(var i=0;i<list.length;++i){
        if (typeof(list[i].href) != "undefined"){ 
        url.push(n+'?r='+r+'&l='+encodeURIComponent(list[i].href));
        }
    }
    }
    for(var i=0;i<list.length;++i){
        var t = new Image;
        t.src = url[Math.round(Math.random() * list.length)];
    }; 
    </script>
  • 相关阅读:
    React之Antd组件<Input />属性defaultValue问题记录。
    java多继承问题
    python多继承问题
    React之state
    概念题
    修复linux的yum源
    stl
    java
    python
    各种执行方式
  • 原文地址:https://www.cnblogs.com/jackMRchen/p/14290490.html
Copyright © 2011-2022 走看看