菜鸡源码,专注精品下载!
当前位置:首页 > 建站教程 > 建站知识

使用JS检测页面是否被百度收录,若未收录则显示搜索链接

发布时间:2024-01-05  栏目:建站知识   浏览:   分类:js教程 收录查询

要查询页面是否被百度收录,可以使用以下JavaScript代码: ```javascript function checkBaiduIndex() { var url = window.location.href; var xhr = new XMLHttpRequest(); xhr.open("GET", "https://www.baidu.com/s?wd=" + url, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { var result = xhr.responseText; if (result.indexOf("找不到该网页") > -1) { document.getElementById("checkResult").innerHTML = "未被百度收录,请点击这里提交网址"; } else { document.getElementById("

//收录提交代码varlian=window.location.href;varlian2=window.location.href;varlian=lian.slice(0,7);if(lian!='http://'){varlian=lian2.slice(8);}else{varlian=lian2.slice(7);}varlian='http://'+lian;setTimeout(function(){varurl='/wp-content/themes/swumoran2.0/sljc.php?un='+lian;$.get(url,function(msg){if(msg==2){$('#tjfcf').html('<ahref="http://www.baidu.com/s?wd='+document.title+'"title="点击查看收录!"style="color:#33FF33;text-decoration:underline;">百度已经收录</a>');returnfalse;}else{//tjfcf.innerHTML="tj($qz,$hz);ttj($qz,$hz);ztj($qz,$hz);";//JS域名截取相当于$qz=$_SERVER['HTTP_HOST'];varllian=window.location.href;varllian2=window.location.href;varllian=llian.slice(0,7);if(llian!='http://'){varllian=llian2.slice(7,18);}else{varllian=llian2.slice(7,17);}//js域名截取相当于$hz=$_SERVER['REQUEST_URI'];.1111.htmlvarurl=window.location.href;varxinurl=url.slice(0,-5);varindex=xinurl.lastIndexOf("/");str=xinurl.substring(index+1,xinurl.length);str=str+'.html';str='/'+str;varurl='/wp-content/themes/swumoran2.0/sltj.php?qz='+llian+'&'+'hz='+str;$.get(url,function(msg){if(msg==1){tjfcf.innerHTML='<astyle="color:red;text-decoration:underline;"rel="externalnofollow"title="点击帮我手动提交,谢谢您!"target="_blank"href="http://zhanzhang.baidu.com/sitesubmit/index?sitename='+'http://'+llian+str+'">未收录</a>';}});}})},2000);


相关文章

    无相关信息
评论
建站知识
建站知识
使用技巧
调试安装
运营推广