js判断设备是都是pc端

function IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}

原文地址:https://www.cnblogs.com/wangyunhui/p/10146154.html

时间: 2024-11-08 22:12:48

js判断设备是都是pc端的相关文章

JS判断设备类型跳转至PC端或移动端相应页面

if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { //window.location.href="你的手机版地址"; }else{ //window.location.href=

JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器

var ua = navigator.userAgent; var browser = {}, weixin = ua.match(/MicroMessenger\/([^\s]+)/i), webkit = ua.match(/WebKit\/([\d.]+)/i), android = ua.match(/(Android)\s+([\d.]+)/i), ipad = ua.match(/(iPad).*OS\s([\d_]+)/i), ipod = ua.match(/(iPod).*OS

PHP和JS判断访问客户端的是PC还是移动设备

js判断 <script type="text/javascript"> function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "ip

JS判断设备的类型

利用JS判断浏览器的用户代理,从而获得设备类型.利用这个方法可以获得用户的设备是移动设备还是PC设备. JS代码如下: function browerType() { var sUserAgent = navigator.userAgent.toLowerCase();   //浏览器的用户代理设置为小写,再进行匹配 var isIpad = sUserAgent.match(/ipad/i) == "ipad";   //或者利用indexOf方法来匹配 var isIphoneOs

媒体查询iphone6、iphone6 plus,js判断设备型号

/* 兼容问题*/@media screen and (device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2){ .dialog-agreement-con{ height: 45%;/* iphone4*/ }} @media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device

php 判断是否手机端还是pc端

来自:https://www.cnblogs.com/webenh/p/5621890.html 用手机访问PC端WWW域名的时候,自动判断跳转到移动端,用电脑访问M域名手机网站的时候,自动跳转到PC端,我们团队在开发erdaicms二代旅游CMS网站管理系统的时候(http://www.erdaicms.com),分别开发了PC端和手机端,需要实现,用手机访问PC端WWW域名的时候,自动判断跳转到移动端,用电脑访问M域名手机网站的时候,自动跳转到PC端,于是有了下面这个判断函数: 1 /*移动

js判断设备是iOS还是安卓

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" /> <title></title> <style&g

js 判断设备

varnish判断 if (req.http.User-Agent ~ "Mobile" || req.http.User-Agent ~ "Nokia" || req.http.User-Agent ~ "SAMSUNG" || req.http.User-Agent ~ "SonyEricsson" || req.http.User-Agent ~ "MOT" || req.http.User-Agen

JS判断客户端是手机还是PC

1 function IsPC() { 2 var userAgentInfo = navigator.userAgent; 3 var Agents = ["Android", "iPhone", 4 "SymbianOS", "Windows Phone", 5 "iPad", "iPod"]; 6 var flag = true; 7 for (var v = 0; v <