请教各位大佬一个问题,有什么方法可以使网站移动端pc端访问不同页面

十年_小赵同学  (UID: 3083) [复制链接]
帖子链接已复制到剪贴板
帖子已经有人评论啦,不支持删除!

2240 7

例如 访客pc端访问 a.com  不作处理

但是移动端访问 a.com  则跳转到 a.com/h5.html

尝试过js处理 通过记录cookis  但是访客浏览器禁止使用cookis 就会出现页面无限刷新的问题

请问大佬还有其他方法可以解决这个问题的吗

这家伙太懒了,什么也没留下。
已有评论 ( 7 )
  • 头像
    一泽 (UID: 3169)
    1楼
    //wap
            /*  *  *  Determine  the  PC  side  and  the  WAP  side  */
            var  mobile_bs  =  {
                    versions:  function()  {
                            var  u  =  navigator.userAgent;
                            return  {
                                    trident:  u.indexOf('Trident')  >  -1,  //IE
                                    presto:  u.indexOf('Presto')  >  -1,  //Opera
                                    webKit:  u.indexOf('AppleWebKit')  >  -1,  //Apple  Google
                                    gecko:  u.indexOf('Gecko')  >  -1  &&  u.indexOf('KHTML')  ==  -1,  //FireFox
                                    mobile:  !!u.match(/AppleWebKit.*Mobile.*/)  ||  !!u.match(/AppleWebKit/)  &&  u.indexOf('QIHU')  &&  u.indexOf('QIHU')  >  -1  &&  u.indexOf('Chrome')  <  0,  //Whether  it  is  a  mobile  terminal
                                    ios:  !!u.match(/\(i[^;]+;(  U;)?  CPU.+Mac  OS  X/),  //iOS
                                    android:  u.indexOf('Android')  >  -1  ||  u.indexOf('Linux')  >  -1,  //Android  or  UC
                                    iPhone:  u.indexOf('iPhone')  >  -1  ||  u.indexOf('Mac')  >  -1,  //iPhone  or  QQ
                                    iPad:  u.indexOf('iPad')  >  -1,  //iPad
                                    webApp:  u.indexOf('Safari')  ==  -1  //Whether  the  web  application  should  have  no  header  and  bottom
                            }
                    }()
            };
            if  (mobile_bs.versions.mobile)  {
                    window.location.href  =  "h5.html";
            }
  • 头像
    十年_小赵同学 (UID: 3083)
    2楼
    谢谢各位大佬    已经php实现了
  • 头像
    十年_小赵同学 (UID: 3083)
    3楼
    一泽 //wap /* * * Determine the PC side and the WAP side */ var mobile_bs = { versions ...
    js方法不行  会无限刷新网页
  • 头像
    陶小桃呀 (UID: 3271)
    4楼
    小赵同学 谢谢各位大佬 已经php实现了
    你倒是分享一下呀表情说不定可以帮助到别的小伙伴
  • 头像
    十年_小赵同学 (UID: 3083)
    5楼
    SmartWood 你倒是分享一下呀表情说不定可以帮助到别的小伙伴
    写的太菜了    贴出来  惹得大佬笑话
  • 头像
    十年_ejsoon (UID: 3308)
    6楼
    網上一搜應該就有,是用後端實現更好。
  • 头像
    2broear (UID: 3237)
    7楼
    为啥用cookie,直接判断ua就完了
域名市场
   域名载入中...
创建新帖
自助推广购买广告位
确认删除
确定要删除这篇帖子吗?删除后将无法恢复。
删除成功
帖子已成功删除,页面将自动刷新。
删除失败
删除帖子时发生错误,请稍后再试。