其他分享
首页 > 其他分享> > 判断手机端还是ipod还是PC(整理)

判断手机端还是ipod还是PC(整理)

作者:互联网


function thtg() {
	if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (
			/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/
			.test(navigator.userAgent))) {

		if (window.location.href.indexOf("?mobile") < 0) {

			try {

				if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {

					//                 window.location.href="http://www.baidu.com";
					// 手机
					$("#hl-selected .itemDiv .item").css("padding-top","0");
					$(".itemAdd").css("margin-top","0");
					$(".itemAddCounter").css("margin-top","0");


				} else if (/iPad/i.test(navigator.userAgent)) {

				} else {

					//                 window.location.href="http://api.touchtao.tech/poetry/index.html?token=cjxt-apieyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyODczYmI3ZDhjMmFhNTlmIiwidWlkIjoxNzIsImNyZWF0ZWQiOjE2MDUyNTQwMDE4OTUsIm5hbWUiOiLku5PpoonlrabloIJfM0ZHWTJKOWtQZCIsImV4cCI6MjIzNTk3NDAwMX0.9Klw6DLREk54lx0hyDp7khKdDFZ5g-4OI8Nn973HA3ieU75rvSJNaZvK1HAjm-pZMo8eJl5gV_EDoiiFA6NbDQ&id=657&typeNum=2";

				}

			} catch (e) {}

		}

	}
}
thtg()

转载-忘记用哪个博主的文章-感谢分享

标签:还是,ipod,PC,window,href,test,userAgent,navigator,top
来源: https://blog.csdn.net/qq_38881495/article/details/122638670