JS判断请求来自Android手机还是iPhone手机,根据不同的手机跳转到不同的链接。

<script>


//点击header处返回按钮时根据移动端系统判断 by gaochunling
var locationBack=(function(){
	var browser = {
		versions: function () {
			var u = navigator.userAgent, app = navigator.appVersion;
			return { //移动终端浏览器版本信息 
				ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 
				android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器 
				iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 
				iPad: u.indexOf('iPad') > -1, //是否iPad 
			};
		}(),
	};
	return function(){
		if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
			window.location.href = "../index.html";
		}
		if (browser.versions.android) {
			window.location.href = "../android.html";
		} 
	}
})()

</script>

  


//点击header处返回按钮时根据移动端系统判断 by gaochunlingvar locationBack=(function(){var browser = {versions: function () {var u = navigator.userAgent, app = navigator.appVersion;return { //移动终端浏览器版本信息 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器 iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 iPad: u.indexOf('iPad') > -1, //是否iPad };}(),};return function(){if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {window.location.href = "../index.html";}if (browser.versions.android) {window.location.href = "../android.html";} }})()

posted @ 2016-04-25 16:35  Gaochunling  阅读(144)  评论(0)    收藏  举报