js判断当前的访问是手机/电脑
<script type="text/javascript">
var commonURL = 'http://www.xxx.com/';
function mobile_device_detect(url){
var thisOS=navigator.platform;
var os=new Array("iPhone","iPod","iPad","android","Nokia","SymbianOS","Symbian","Windows Phone","Phone","Linux armv71","MAUI","UNTRUSTED/1.0","Windows CE","BlackBerry","IEMobile");
for(var i=0;i<os.length;i++){
if(thisOS.match(os[i])){
window.location=url;
}
}
if(navigator.platform.indexOf('iPad') != -1){
window.location=url;
}
var check = navigator.appVersion;
if( check.match(/linux/i) ){
if(check.match(/mobile/i) || check.match(/X11/i)) {
window.location=url;
}
}
Array.prototype.in_array = function(e){
for(i=0;i<this.length;i++){
if(this[i] == e)
return true;
}
return false;
}
}
mobile_device_detect("跳转地址");/*指定跳转地址*/
</script>

js判断当前的访问是手机/电脑的更多相关文章
- js判断当前的访问是手机还是电脑
<script type="text/javascript"> //平台.设备和操作系统 var system ={ win : false, mac : false, ...
- JS判断移动端访问设备并加载对应CSS样式
JS判断不同web访问环境,主要针对移动设备,提供相对应的解析方案(判断设备代码直接copy腾讯网的) // 判断是否为移动端运行环境 if(/AppleWebKit.*Mobile/i.test(n ...
- JS判断web网站访问端是PC电脑还是手机
通过JS语句判断WEB网站的访问端是电脑还是手机,以显示不同的页面! <script type="text/javascript"> <!-- //平台.设备和操 ...
- js 判断用户是手机端还是电脑端访问
通过userAgent 判断,网页可以直接使用 navigation对象 node端 可以通过请求头的 ctx.request.header['user-agent'] const browser = ...
- php判断当前的访问是手机还是电脑
<?php function check_wap() { if (isset($_SERVER['HTTP_VIA'])) return true; if (isset($_SERVER['HT ...
- H5_0006:JS判断PC,平板,手机平台的方法
<script type="text/javascript"> //平台.设备和操作系统var system = { win: false, mac: false, x ...
- js判断是android访问还是ios访问
原文地址:http://blog.csdn.net/wy978651775/article/details/9014039 该博主也是转载的,但是没有标明出处. 判断原理: JavaScript是前端 ...
- js判断是否第一次访问跳转
今天分享一套关于Js劫持代码,进行判断第一次访问进行跳转,仅供大家参考学习! 未加密: if (c.indexOf('isfirstvisited=false') != -1) { } else { ...
- js判断客户端是pc还是手机及获取浏览器版本
//判断是pc还是移动端 function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bI ...
随机推荐
- 深入浅出Mybatis-与Spring集成
单独使用mybatis是有很多限制的(比如无法实现跨越多个session的事务),而且很多业务系统本来就是使用spring来管理的事务,因此mybatis最好与spring集成起来使用. 前置要求 版 ...
- Openstack Neutron 允许VM流量转发
neutron port-update <port-id> --port-security-enabled=False --no-security-groups
- 【自动部署】Ansible 怎么通过堡垒机/跳板机 访问目标机器
Ansible机器的 /root/.ssh/config 配置如下即可:Host 目标机器IP User root IdentityFile=/root/.ssh/xxx_id_rsa ProxyCo ...
- Strobogrammatic Number
Strobogrammatic Number I A strobogrammatic number is a number that looks the same when rotated 180 d ...
- Java中 final static super this instanceof 关键字用法
一.final关键字 final可以修饰变量.方法及类: 1.当定义一个final变量时,jvm会将其分配到常量池中,其所修饰的对象只能赋值一次,对基本类型来说是其值不可变,引用类型(包括作为函数形参 ...
- FIDO 标准简介
FIDO 联盟(Fast IDentity Online Alliance)简介 网站:http://fidoalliance.org FIDO Alliance,成立于2012年7月. FIDO的目 ...
- Unity3d《Shader篇》变胖
变胖前 变胖后 //Shader Shader "Custom/NormalExt" { Properties { _MainTex("Base (RGB)", ...
- ios UIButton 选中后背景图片变化发灰问题
UIButton的类型如果选择了System类型,那么设置背景图后,点击的效果是图片发灰,而不是默认的那种图片变淡黑色效果,需要用customer类型就好了.
- Java for LeetCode 210 Course Schedule II
There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...
- SpringMVC,3种不同的URL路由配置方法(这根本不是一个小问题)
转载自:http://blog.csdn.net/fansunion/article/details/41149287?utm_source=tuicool&utm_medium=referr ...