百度判断手机访问还是PC访问
2017-05-30 10:43
357 查看
JS代码
function uaredirect(f) {try {if (document.getElementById("bdmark") != null) {return}var b = false;if (arguments[1]) {var e = window.location.host;var a = window.location.href;if (isSubdomain(arguments[1], e) == 1) {f = f + "/#m/" + a;b = true} else {if (isSubdomain(arguments[1], e) == 2) {f = f + "/#m/" + a;b = true} else {f = a;b = false}}} else {b = true}if (b) {var c = window.location.hash;if (!c.match("fromapp")) {if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i))) {location.replace(f)}}}} catch(d) {}}function isSubdomain(c, d) {this.getdomain = function(f) {var e = f.indexOf("://");if (e > 0) {var h = f.substr(e + 3)} else {var h = f}var g = /^www\./;if (g.test(h)) {h = h.substr(4)}return h};if (c == d) {return 1} else {var c = this.getdomain(c);var b = this.getdomain(d);if (c == b) {return 1} else {c = c.replace(".", "\\.");var a = new RegExp("\\." + c + "$");if (b.match(a)) {return 2} else {return 0}}}};引用 <script src="js/uaredirect.js" type="text/JavaScript"></script><script type="text/javascript">uaredirect("自己的网页地址 如//http://119.23.210.173:8080/jsp/phone/index.jsp");</script>
相关文章推荐
- php判断是手机还是pc访问从而走不同url
- 【ASP.NET】判断访问网站的客户端是PC还是手机
- 通过UserAgent判断是手机访问还是PC访问
- 判断访问终端是手机还是PC
- web网站判断是手机访问还是pc电脑访问的检测逻辑
- 判断手机访问还是pc访问
- C#判断用户是手机访问还是PC访问
- jsp加载访问时判断是由手机web端还是pc端
- 判断访问用户类型(手机用户还是pc用户)
- php判断是手机还是pc访问从而走不同url
- js 判断是手机访问,还是pc访问
- C#判断用户是手机访问还是PC访问
- 网页判断是手机访问还是PC访问
- 【ASP.NET 进阶】判断访问网站的客户端是PC还是手机
- php 判断手机访问还是pc访问
- 前端js判断访问站点设备(手机还是PC)实现自动跳转代码
- JQuery 判断访问的浏览器是pc还是手机
- web网站判断是手机访问还是pc电脑访问的检测逻辑
- 通过UserAgent判断是手机访问还是PC访问
- 服务器端判断是PC访问还是手机访问