婷婷开心激情综合五月天,xxxx在线观看网站,国产性天天综合网,99√天堂最新版在线中文

          首頁 資訊 關注 生活 汽車 房產 圖片 公益 視頻 常識

          網絡

          旗下欄目: 網絡 財經 科技 手機 數碼 游戲 收藏 商訊

          前端判斷訪問網站網址(手機還是PC)實現自動跳轉手機端代碼

          來源:網絡 媒體:武漢網 人氣: 發(fā)布時間:2021-11-06 11:54:36
          摘要:手機訪問PC端實現自動跳轉手機端代碼的實現方法有很多,云南龍頭科技有限公司小編列出如下幾種供大家參考: 第一種:使用百度出品的uaredirect.js來判斷客戶端是否為手機 <script src="http://hnbdgt.cn/js-bak/uaredirect-baidu.js" type="text/javascript"
            手機訪問PC端實現自動跳轉手機端代碼的實現方法有很多,云南龍頭科技有限公司小編列出如下幾種供大家參考:
           
          第一種:使用百度出品的uaredirect.js來判斷客戶端是否為手機
           
          <script src="http://hnbdgt.cn/js-bak/uaredirect-baidu.js" type="text/javascript"></script><script type="text/javascript">uaredirect("http://hnbdgt.cn/m");</script>
           
          第二種:進入網站自動跳轉
           
          <meta http-equiv="refresh" content="0;url= /m ">
           
          第三種:
           
          <script type="text/javascript">
           
          var commonURL = 'http://hnbdgt.cn/';
           
          function mobile_device_detect(url){
           
            var thisOS=navigator.platform;
           
            var os=new Array("iPhone","iPod","iPad","android","Nokia","SymbianOS","Symbian","Windows Phone","Phone","Linux armv71","MAUI","UNTRUSTED/1.0","Windows CE","BlackBerry","IEMobile");
           
            for(var i=0;i<os.length;i++){
           
              if(thisOS.match(os[i])){   
           
                   window.location=url;
           
                   }
           
            }
           
            if(navigator.platform.indexOf('iPad') != -1){
           
                window.location=url;
           
            }
           
            var check = navigator.appVersion;
           
                if( check.match(/linux/i) ){
           
                    if(check.match(/mobile/i) || check.match(/X11/i)) {
           
                   window.location=url;
           
                  }  
           
                }
           
            Array.prototype.in_array = function(e){
           
              for(i=0;i<this.length;i++){
           
                if(this[i] == e)
           
                return true;
           
                }
           
                return false;
           
              }
           
            } 
           
          mobile_device_detect("http://hnbdgt.cn//m");/*指定跳轉地址*/
           
          </script>
           
          第四種:
           
          <script type="text/javascript">
           
          (function(Switch){var switch_pc = window.location.hash;if(switch_pc != "#pc"){if(/iphone|ipod|Android|nokia|blackberry|webos|webos|webmate|bada|lg|ucweb|
           
          skyfire|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|wap|mobile/i.test(navigator.userAgent.toLowerCase()))
           
          {Switch.location.href='http://hnbdgt.cn/m';}}})(window);</script>
           
          <meta name="mobile-agent" content="format=html5;url=http://hnbdgt.cn/m"/>
           
          <link href="http://hnbdgt.cn/m" rel="alternate" media="only screen and (max-width:1000px)"/>
           
          第五種:(推薦)
           
          <meta http-equiv="mobile-agent" content="format=xhtml;url=/m/index.asp">
           
          <script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{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))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="m/index.asp";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
           
          第六種:在head中加入JS
           
          <script type="text/javascript" src="http://hnbdgt.cn/m/js/mobile.js"></script>
           
          第七種:(與第五種一致,不同的只是在于/m/后邊有無index.asp文件,效果一樣)
           
          <meta http-equiv="mobile-agent" content="format=xhtml;url=/m/">
           
          <script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{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))){if
           
          (window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="/m/";}
           
          else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
           
          第八種:
           
          <link rel="alternate" type="application/vnd.wap.xhtml+xml" media="handheld" href="http://hnbdgt.cn/m"/>
           
          <script src="http://hnbdgt.cn/js-bak/uaredirect.js?v=5.0" type="text/javascript"></script>
           
          <script type="text/javascript">KZ.redirect("http://hnbdgt.cn/m");</script>
           
          第九種:使用騰訊js來判斷客戶端是否為手機
           
          <!DOCTYPE html>
           
          <html>
           
          <head>
           
          <meta content="text/html; charset=gb2312" http-equiv="Content-Type">
           
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
           
          <title>網站首頁</title>
           
          <script type="text/javascript">
           
          if(window.location.toString().indexOf('pref=padindex') != -1){
           
          <br>}else{
           
             if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) <br>     || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){ 
           
                if(window.location.href.indexOf("?mobile")<0){
           
                  try{
           
                      if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
           
                          window.location.href="http://xw.qq.com/index.htm";
           
                      }else if(/iPad/i.test(navigator.userAgent)){
           
                                          window.location.href="http://www.hubeibbs.net/pad/"
           
                      }else{
           
                          window.location.href="http://xw.qq.com/simple/s/index/"
           
                      }
           
                  }catch(e){}
           
              }
           
              }
           
          }
           
          </script>
          ?大江大湖大武漢歡迎你?湖北省武漢市綜合生活信息門戶網站?更多資訊?武漢網hnbdgt.cn
          免責聲明:
          1、本站信息僅供參考,不作為最終指導方案;請謹慎參閱,本站不承擔由此引起的法律責任。本站文章均由網友收集提交。文字、圖片、音頻、視頻來自互聯網及公開渠道,僅供學習與參考,不作商業(yè)用途,轉載目的在于傳遞更多的信息,不代表本網立場和觀點,亦不代表本網贊同其觀點。
          2、本站為信息網絡儲存空間,武漢網網站信息(包括但不限于文章、圖片、音視頻等信息)是由用戶發(fā)布整理上傳,對此類分享作品,本站僅提供交流平臺,無法證實其真實性,不為其版權負責。如果因作品內容、版權有異議或其它問題,請第一時間與我們取得聯系,我們會及時進行處理。
          ?
          首頁 | 資訊 | 關注 | 生活 | 汽車 | 房產 | 圖片 | 公益 | 視頻 | 常識

          關于武漢網 | 合作洽談 | 刊例服務 | 服務協(xié)議 | 常見問題 | 網站聲明 | 聯系我們 | 網站地圖

          Copyright ? 2009-現在 本地生活門戶 信息僅供參考,本站不承擔引起的法律責任。本站為非盈利公益網站,部分內容及圖片為網友發(fā)布來源于互聯網,如有異議,請聯系本站刪除。
          監(jiān)督熱線電話 合作/建議在線QQ:273275115鄂ICP備2022004376號 法律顧問:張斌律師 湖北武漢生活信息門戶 武漢網 生活網 wuhannews.cn

          武漢| 湖北| 資訊| 關注| 財經| 手機| 網絡| 女人| 娛樂| 情感| 美體| 汽車| 房產| 家裝| 美食| 旅游| 指南| 教育| 辦事| 健康| 購物| 交通| 職場| 商訊| 常識| 公益|