手机访问自动跳转到首页或相应文章地址,在模板文件header.php中<head></head>之间加入如下代码即可。- <script type="text/javascript"> 5 l9 f8 p6 V6 p- m; B- ^+ E
- 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))){ u/ Y% f5 z* V. B! B# v3 ?
- if(window.location.href.indexOf("?mobile")<0){
& i8 z3 B8 X' g - try{; r7 ?$ f0 ?/ `, L/ A. G
- if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){3 [5 Q) c! [7 d
- window.location.href="<?php echo BLOG_URL; ?>/m/?post=<?php echo $logid;?>";& W2 w0 r2 x; M" t. f0 i
- }
$ b! c4 G% o0 _, H: }( Y# I - }catch(e){}/ a u7 A' H. }/ W& g4 t" `5 Q
- }/ c# H) o/ ~! b
- }/ P' v) A) g8 J( u) a
- </script>
复制代码
# D, j5 I8 ]3 U; l5 B* l ` |