[关闭]
@Wangww0925 2019-08-07T07:56:50.000000Z 字数 694 阅读 181

判断是手机还是pc打开

js


代码

  1. <script type="text/javascript">
  2. if(window.location.toString().indexOf('pref=padindex') != -1){
  3. }else{
  4. 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))){
  5. if(window.location.href.indexOf("?mobile")<0){
  6. try{
  7. if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
  8. window.location.href="http://xw.qq.com/index.htm";
  9. }else if(/iPad/i.test(navigator.userAgent)){
  10. //window.location.href="http://www.qq.com/pad/"
  11. }else{
  12. window.location.href="http://xw.qq.com/simple/s/index/"
  13. }
  14. }catch(e){}
  15. }
  16. }
  17. }
  18. </script>

作者 wendy
2017 年 7月 22日

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注