其他分享
首页 > 其他分享> > PC跳YD或互跳 JS

PC跳YD或互跳 JS

作者:互联网

 1     <script>//PC跳YD
 2         var browser={
 3             versions:function(){
 4                 var u = navigator.userAgent, app = navigator.appVersion;
 5                 return {
 6                     mobile: !!u.match(/AppleWebKit.*Mobile/) || !!u.match(/Windows Phone/) || !!u.match(/Android/) || !!u.match(/MQQBrowser/)
 7                 };
 8             }()
 9         }
10         if(browser.versions.mobile) {
11             var qustr = location.pathname;
12             location.replace("//m.hnmsgf.com"+qustr);
13         }
14     </script>
15 
16 
17 
18 <script>//YD跳PC
19         var browser={
20             versions:function(){
21                 var u = navigator.userAgent, app = navigator.appVersion;
22                 return {
23                     mobile: !!u.match(/AppleWebKit.*Mobile/) || !!u.match(/Windows Phone/) || !!u.match(/Android/) || !!u.match(/MQQBrowser/)
24                 };
25             }()
26         }
27         if(!browser.versions.mobile) {
28          var qustr = location.pathname;
29          location.replace("//www.hnmsgf.com"+qustr);
30         }
31 </script>

 

标签:versions,mobile,YD,PC,或互,location,var,navigator,match
来源: https://www.cnblogs.com/pensive/p/14225320.html