JS判断手机端是否安装某应用
方法一(网页上判断)
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 = "要跳转的页面URL"; } else { window.close(); } }, 25); } else if (navigator.userAgent.match(/android/i)) { var state = null; try { } catch(e) {} if (state) { window.close(); } else { window.location = "要跳转的页面URL"; } }方法二
function testApp(url) { var timeout, t = 1000, hasApp = true; setTimeout(function () { if (hasApp) { alert('安装了app'); } else { alert('未安装app'); } document.body.removeChild(ifr); }, 2000) var t1 = Date.now(); var ifr = document.createElement("iframe"); ifr.setAttribute('src', url); ifr.setAttribute('style', 'display:none'); document.body.appendChild(ifr); timeout = setTimeout(function () { var t2 = Date.now(); if (!t1 || t2 - t1 < t + 100) { hasApp = false; } }, t); } 方法三(APP里判断)
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if(isAndroid){ function android(){ window.setTimeout(function(){ },2000); };if(isiOS){ function ios(){ var ifr = document.createElement("iframe"); ifr.style.display = "none"; document.body.appendChild(ifr); window.setTimeout(function(){ document.body.removeChild(ifr); },2000) };}JS判断手机端是否安装某应用的更多相关文章
- js判断手机端操作系统(Andorid/IOS)
非常实用的js判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL = "http://xxx/xxx.apk"; var browser = ...
- js判断手机端操作系统的两种方法
//判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL ="http://xxx/xxx.apk"; var browser = { ver ...
- js判断手机端
if (window.location.toString().indexOf('pref=padindex') != -1) { } else { if (/AppleWebKit.*Mobile/i ...
- 原生js判断手机端页面滚动停止
var topValue = 0,// 上次滚动条到顶部的距离 interval = null;// 定时器 contactsList = document.getElementById(" ...
- js判断手机端操作系统(Andorid/IOS),并自动为链接添加相应下载地址
<script type="text/javascript"> $(document).ready(function(e) { var u = navigator.us ...
- js判断手机端Android手机还是iPhone手机
/*判断当前设备是平板.安卓.苹果设备*/ <script type="text/javascript"> function fBrowserRedirect(){ v ...
- js判断手机端(Android手机还是iPhone手机)
/** * [isMobile 判断平台] * @param test: 0:iPhone 1:Android */ function ismobile(test){ var u = navigato ...
- JS判断手机端和PC端自动跳转
<script type="text/javascript"> function browserRedirect() { var sUserAgent ...
- js判断手机端和pc端
var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...
随机推荐
- java服务端的 极光推送
项目中用到了极光推送 下面写下笔记 首先引入jar包 下载地址https://docs.jiguang.cn/jpush/resources/(非maven项目的下载地址) <depend ...
- Spring Boot 非常好的学习资料
from@https://gitee.com/didispace/SpringBoot-Learning Spring Boot 2.0 新特性学习 简介与概览 Spring Boot 2.0 正式发 ...
- QT4.8.6-VS2010开发环境配置
目录 1.下载软件 2.环境配置 3.VAssistX配置 1.下载软件 VS2010下载地址:链接: https://pan.baidu.com/s/1gvPjZWBtSEwW37H1xf2vbA ...
- Eclipse Build path
Build Path用于设置Java的构建路径,管理Java工程所包含的资源,使工程结构清晰合理. 包括以下几项: Source Source包括 source folder和output folde ...
- 汉语言处理工具pyhanlp的简繁转换
繁简转换 HanLP几乎实现了所有我们需要的繁简转换方式,并且已经封装到了HanLP中,使得我们可以轻松的使用,而分词器中已经默认支持多种繁简格式或者混合.这里我们不再做过多描述. 说明: ·Ha ...
- SQL Agent 服务无法启动
问题现象 从阿里云上镜像过来的一台的数据库服务器,SQL Agent服务启动不了,提示服务启动后停止. 如下是系统日志和SQL Agent的日志 SQLServerAgent could not be ...
- Flask-ORM-数据库的对象关系映射模型-备忘
ORM对象关系映射模型的特点: 优点 : 只需要面向对象编程, 不需要面向数据库编写代码. 对数据库的操作都转化成对类属性和方法的操作. 不用编写各种数据库的sql语句. 实现了数据模型与数据库的解耦 ...
- DokuWiki 插件使用
本身DokuWiki提供了一些公共,但是不是很强大,所以可以安装一些插件. 安装方法可以参考:https://www.dokuwiki.org/extensions 下面列举出我觉得好用的一些插件: ...
- python:函数初始
一.函数 1.函数初始:函数就是封装一个功能 2.函数名,函数体,关键字,函数的返回值 def 关键字,定义一个函数 my_len 函数名书写规则和变量一样 def 与函数名中间一个空格 函数名(): ...
- CRM 模拟用户
web api 模拟用户 转:https://blog.csdn.net/vic0228/article/details/80649615 var req = new XMLHttpRequest() ...