虽然在Js中可以启动某个app,但是并不能判断该app是否安装;
但是,但是….还是有奇思淫巧滴,启动app需要的时间较长,js中断时间长,如果没安装,js瞬间就执行完毕。直接上代码吧!
html代码:
打电话
js代码:
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
hasApp = false;
}
}, t);
} 参考文档:http://www.cnblogs.com/yexiaochai/p/3439179.html
相关资源:橘子快速启动软件(橘子启动器)v3.0绿色免费版-其它代码类资源…
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!