[auto-download-app] 如何使用 javascript 实现 app 自动下载?

// 在访客跳转进入的页面中,执行下面使用下面 invoke function 
(function(){ var str_downloadUrl = "<!--{$apkUrl}-->"; var str_scheme = "hinabian://openwith"; if($.os.iphone) { str_downloadUrl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.hinabian.migrate"; str_scheme = ""; } function openApp() { location.href = str_downloadUrl; /* var e = document.createElement("iframe"); e.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;"; e.src = str_scheme; document.body.appendChild(e); startTime = (new Date).valueOf(); setTimeout(function () { var endTime = (new Date).valueOf(); if (1550 > endTime - startTime) { location.href = str_downloadUrl; } }, 1500); */ } $("#id_download_btn").click(openApp); setTimeout(function(){ openApp(); } , 1000); })();