JS判断客户端是否是iOS或者Android还是电脑端

来源:互联网 发布:win10翻墙软件 编辑:程序博客网 时间:2024/04/30 05:21

最近一直在弄网站,还要做响应式,还要区分不同系统

if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {    //alert(navigator.userAgent);      window.location.href ="iPhone.html";} else if (/(Android)/i.test(navigator.userAgent)) {    //alert(navigator.userAgent);     window.location.href ="Android.html";} else {    window.location.href ="pc.html";};



先判断是否是苹果系统 ,然后是安卓系统,都不是的情况下就是pc页面

0 0
原创粉丝点击