js判断手机是安卓还是ios

//点击下载按钮判断appDown() {    var u = navigator.userAgent;    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);    var isAndroid = u.indexOf(‘Android‘) > -1 || u.indexOf(‘Adr‘) > -1; //android终端    if(isiOS){        window.location.href = ‘安卓下载地址‘    }else if(isAndroid){        window.location.href = ‘安卓下载地址‘    }},

原文地址:https://www.cnblogs.com/myfirstboke/p/9178649.html

时间: 2024-08-30 09:11:56

js判断手机是安卓还是ios的相关文章

JS判断客户端是安卓还是iOS

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

js判断手机浏览器操作系统和微信浏览器的方法

做手机端的前端开发,少不了对手机平台的判断.如,对于app下载,就要判断在Android平台下就显示Android下载提示:在iOS平台下就显示iOS下载提示. 今天就为大家介绍一下用js判断手机客户端平台及系统平台的方法: <script type="text/javascript"> //手机端判断各个平台浏览器及操作系统平台 function checkPlatform(){ if(/android/i.test(navigator.userAgent)){ docu

js判断手机浏览器

最新浏览器识别合并. demo:http://v.qq.com    ->   http://v.qq.com/h5 http://v.qq.com/    ->   http://v.qq.com/h5 http://v.qq.com/h5    ->   http://v.qq.com/h5 <script type="text/javascript"> (function(W){ if(!/\/h5/.test(W.location.pathname

php判断手机是安卓系统还是ios系统

最近项目,要判断用户的手机是安卓的还是ios的,搜了一下相关的资料,最终获得的结果.事实证明,是有效的!主要是要用到HTTP_USER_AGENT,它表示的意思是用来检查浏览页面的访问者在用什么操作系统(包括版本号)浏览器(包括版本号)和用户个人偏好的代码. 监测代码如下: function get_device_type() { //全部变成小写字母 $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $type = 'other'; //分别进

php js 判断手机访问

<?php function isMobile(){ $useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $useragent_commentsblock=preg_match('|\(.*?\)|',$useragent,$matches)>0?$matches[0]:''; function CheckSubstrs($substrs,$text){ foreach($subst

原生JS判断手机系统

点击图片,判断手机操作系统,根据手机系统跳转不同链接. function imgHref(){ var userAgent = navigator.userAgent; var isAndroid = userAgent.indexOf('Android') > -1 || userAgent.indexOf('Adr') > -1; //android终端 var isiOS = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //io

js判断手机是否安装了某一款app,有则打开,没有去下载

function openApp(){ if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new Date(); window.setTimeout(function() { var timeOutDateTime = new Date(); if(timeOutDateTime - loadDateTime < 5000) { window.location = "要跳转的下载app页面

js监测设备类型【安卓,ios,苹果微信,电脑pc】

话不多说上代码: 1 2 3 4 5 6 7 8 9 1.判断是不是微信     function is_weixn(){         var ua = navigator.userAgent.toLowerCase();         if(ua.match(/MicroMessenger/i)=="micromessenger") {             //alert('苹果微信');         } else {             //alert("

js判断手机浏览器是横屏or竖屏

移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态. 从而根据实际需求而执行相应的程序.通过添加监听事件onorientationchange,进行执行就可以了. //判断手机横竖屏状态: function hengshuping(){ if(window.orientation==180||window.orientation==0){ alert("竖屏状态!") } if(window.orientation==