<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js判断设备类型是移动设备还是PC设备</title>
<script type="text/javascript">
// borwserRedirect
(function browserRedirect(){
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
var bIsIphone = sUserAgent.match(/iphone os/i) == 'iphone os';
var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
var bIsUc = sUserAgent.match(/ucweb/i) == 'web';
var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile'; if(bIsIpad || bIsIphone || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM){
window.location.href = 'http://www.163.com/';
}else{
window.location.href = 'http://www.baidu.com/';
}
})();
</script>
</head>
<body>
<h1>pc浏览</h1>
</body>
</html>

js判断设备(转)的更多相关文章

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

    JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器 var ua = navigator.userAgent; var browser = {}, weixin ...

  2. JS判断设备的类型

    利用JS判断浏览器的用户代理,从而获得设备类型.利用这个方法可以获得用户的设备是移动设备还是PC设备.     JS代码如下:       function browerType() {       ...

  3. js判断设备,跳转app应用、android市场或者AppStore

    js移动设备判断方法大全 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" > ...

  4. JS 判断设备来源

    1.js代码判断当前设备: function deviceType(){ var ua = navigator.userAgent; var agent = ["Android", ...

  5. 开发中少不了的Fun -- js判断设备

    判断是否是移动设备 var ua = window.navigator.userAgent.toLowerCase(); if(ua.indexOf('mobile')!== -1){ return ...

  6. js判断设备信息,安卓、ios、还是pc端

    前端开发获取设备信息的代码if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { window.location.href =" ...

  7. js判断设备是否为安卓

    var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > - ...

  8. js判断设备是都是pc端

    function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = new Array("Android" ...

  9. js 判断设备的来源

    function deviceType(){ var ua = navigator.userAgent; var agent = ["Android", "iPhone& ...

随机推荐

  1. HTML5知识点总结(一)

    最近在复习前端的基础知识,在这里做一个总结,这是HTML5篇. 新特性 取消了过时的显示效果标记<font></font>和<center></center& ...

  2. 【leetcode】1025. Divisor Game

    题目如下: Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a numb ...

  3. python使用qq邮箱向163邮箱发送邮件、附件

    在生成html测试报告后 import smtplib,time from email.mime.text import MIMEText from email.mime.multipart impo ...

  4. maven之可执行jar包

    在使idea创建springboot项目时,pom.xml文件中自动会添加下面这个插件. <build> <plugins> <plugin> <groupI ...

  5. Python3解leetcode Factorial Trailing Zeroes

    问题描述: Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 ...

  6. 如何在Ubuntu下搭建tftp服务器

    远程桌面连接工具   今天开始调试arm的板子,要通过tftp下载到板子上,所以又要配置tftp服务器,真的烦死了… (本人酷爱装系统,所以经常都要搞配置) 因为之前已经在Ubuntu下搭建过很多次t ...

  7. PHPthink 配置目录

    系统默认的配置文件目录就是应用目录(APP_PATH),也就是默认的application下面,并分为应用配置(整个应用有效)和模块配置(仅针对该模块有效). ├─application 应用目录 │ ...

  8. redis哨兵-5

    #地址: https://www.cnblogs.com/PatrickLiu/p/8444546.html #常用架构 redis1主1从+3哨兵 实现redis高可用 #redis主从 ##### ...

  9. hdu 5564 Clarke and digits

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5564 ------------------------------------------------ ...

  10. 配置github的pull request触发jenkins自动构建

    参照: https://www.cnblogs.com/zanjiahaoge666/p/6402738.html 之前的配置,都是向master分支push操作触发jenkins进行构建,但是在一般 ...