百度主动推送代码 批量改进版

<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>

百度主动推送代码,批量推送页面所有URL。改进修复推送undefined错误问题。

posted @ 2020-12-08 20:24  MRtanchen  阅读(198)  评论(0编辑  收藏  举报