手机站-> 知识点
2015-08-10 14:43
225 查看
自动识别跳转代码(用于pc端,放于页面头部):
修改uaredirect值即可
------------------------------
<script language="javascript"> 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}}}}; uaredirect("http://www.abc.com/m", "http://www.abc.com"); </script>
修改uaredirect值即可
------------------------------
相关文章推荐
- mongodb pre-splitting sharding测试
- hdu-2087 剪花布条
- Java数字时钟(现在是北京时间 20:13:14)
- 知识点四:Menu和actionBar用法
- android ListView奇偶行显示不同颜色
- C++与Java的语法区别
- Unity中游戏的声音管理
- iOS 使用const定义项目全局变量
- javascript学习笔记(数组)-2015-08
- 《Linux设备驱动开发详解(第3版)》(即《Linux设备驱动开发详解:基于最新的Linux 4.0内核》)网购链接
- [最短路]使用优先队列优化的Dijkstra算法
- 流量控制与拥塞控制
- POJ 1011 Sticks 经典的dfs+剪枝
- 九度OJ 题目1468:Sharing
- 相机标定
- Android 内存优化总结
- 爱福窝在线装修设计软件测评
- C++ 的那些坑 (Day 1)
- 发送带附件的邮件
- Linux磁盘与文件系统管理(4)