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 ...
随机推荐
- c# 号码记录,车友
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- JSON的一些小结
一.js中 1.json字符串转json对象 var json = $.parseJSON(" {'1':'hello'},{'2':'word'} "); for(var i i ...
- jQuery 点击后退(返回)执行函数
<html> <head> <meta charset="UTF-8"> <meta name="viewport" ...
- [C#]时间格式和字符串的相互转换
一.字符串转化为时间格式 string date = "2018/9/27 10:53:56"; DateTime dt1 = DateTime.Parse(date);//方式1 ...
- insert 插入
自动关联当前时间: GETDATE():返回当前时间和日期.
- 关于tpg例程的仿真
关于tpg例程的仿真 processor system reset---rst_clk_wiz_0_148M 可以看出interconnect_aresetn和peripheral_aresetn的复 ...
- PCLVisualizer可视化类
PCLVisualizer可视化类 转载自 http://www.cnblogs.com/li-yao7758258/p/6445127.html 如有疑问,请转至该网址留言询问 PCLVisuali ...
- python3学习笔记四(列表1)
参考http://www.runoob.com/python3/python3-list.html 序列 python包含6种内建的序列:列表,元组,字符串,Unicode字符串,buffer对象和x ...
- 2018-2019-1 20165205 ch02 课下作业
ch02 课下作业 2.96 代码 #include <stdio.h> #include <stdlib.h> typedef unsigned float_bits; fl ...
- gentoo emerge L10N
gentoo 中安装软件的时候 emerge 提示 USE 中有 语言包可选安装,使用 L10N 来设置,设置方法是在USE中使用 l10n_,比如说 l10n_zh_CN 来安装中文支持包.