function mobile_device_detect(url) { var thisOS = navigator.platform; var os = new Array("iPhone", "iPod", "iPad", "android", "Nokia", "SymbianOS", "Symbian", "Windows Phone",…
1.PC版首页</head>标签前加上以下脚本 <script src="/tools/browser_redirect.ashx"></script> browser_redirect.ashx输出内容为以下代码: function getMCookie(objName) { var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.lengt…
测试网页在手机上的显示工具我们可以使用谷歌内核的浏览器,打开开发者工具(F12),在device那里选择设备,然后刷新来查看网页在手机上的显示效果. 但毕竟是模拟的,如果想要在真机上调试该怎么办呢. 手机可以访问的电脑的本地站点的本质是手机通过浏览器输入电脑的IP地址及本地部署站点的端口来访问.手机只有与 PC 端在同一个局域网才可以访问. 1.情况一:手机和 PC 端连接同一局域网 手机通过 PC 端的IP地址及部署端口直接访问. 2.情况二:没有wifi,电脑连接以太网 (1)在 PC 端开…
<SCRIPT LANGUAGE="JavaScript">function mobile_device_detect(url){ var thisOS=navigator.platform; var os=new Array("iPhone","iPod","iPad","android","Nokia","SymbianOS"…
<script type="text/javascript">(function() { //得到域名后缀 var path = location.pathname.split('/') path = path.pop(); var ua = navigator.userAgent.toLowerCase(); var bIsIpad = ua.match(/ipad/i) == "ipad"; var bIsIphoneOs = ua.match(/i…
<script type="text/javascript"> //移动端url跳转,自定义部分开始 function mobile_device_detect(url) { var thisOS = navigator.platform; var os = new Array("iPhone", "iPod", "iPad", "android", "Nokia", &qu…
//例如:iphone访问www.baidu.com自动跳转到wap.baidu.com,只需在pc端模版页面引入以下js代码//pc zhuan mobile var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "…
判断当前设备(终端)是手机还是pc端并进行不同的页面跳转 DEMO 1 <script type="text/javascript"> function browserRedirect() { var sUserAgent= navigator.userAgent.toLowerCase(); var bIsIpad= sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs= sUserAgent.mat…