Posted on
2017-07-31 17:13
powerixao
阅读(
166)
评论()
收藏
举报
- function startApp(url, url2) {
- <span style="white-space:pre"> </span>
- <span style="white-space:pre"> </span>
-
- downloadUrl = url2;
- if(ua.match(/ipad|iphone|ipod|ios/i)) {
-
-
- window.setTimeout(function() {
- $('#message').html('');
- $('.result-message').eq(0).css("display", "none");
- clearTimeout(loop);
- time = parseInt('6000') / 1000;
- }, 6000);
-
- location.href = url;
-
- countDown();
-
- } else {
-
- window.setTimeout(function() {
- $('#message').html('');
- $('.result-message').eq(0).css("display", "none");
- clearTimeout(loop);
- time = parseInt('6000') / 1000;
- }, 6000);
-
- openApp(url);
-
- }
-
- }
-
- function openApp(src) {
-
- var ifr = document.createElement('iframe');
- ifr.src = src;
- ifr.style.display = 'none';
- document.body.appendChild(ifr);
-
-
- countDown();
- window.setTimeout(function() {
- document.body.removeChild(ifr);
- }, 5000);
-
-
- }
-
- function countDown() {
-
- loop = window.setTimeout('countDown()', 1000);
- if(time > 0) {
- $('.result-message').eq(0).css("display", "block");
- $('#message').html('正在尝试打开客户端 ' + time + 's');
-
- time--;
- if(time == 0) {
-
-
-
- $('#message').html('');
- $('.result-message').eq(0).css("display", "none");
- clearTimeout(loop);
- time = parseInt('6000') / 1000;
- var btnArray = ['否', '是'];
- mui.confirm('您没有安装该应用,是否下载安装包?', '应用下载', btnArray, function(e) {
- if(e.index == 1) {
- location.replace(downloadUrl);
- } else {
- return;
- }
- });
- }
- }
- }