アプリのインストール確認(存在しない場合はインストール用URLへ)
アプリがインストールされていないとき
main.js
function launchApp(appUrl, storeUrl) { var iframe, time; iframe = document.createElement('iframe'); iframe.style.visibility = "hidden"; iframe.src = appUrl; document.body.appendChild(iframe); time = (new Date()).getTime(); setTimeout(function() { var now = (new Date()).getTime(); document.body.removeChild(iframe); if ((now - time) > 400) { return; } // alert(storeUrl); //test用 document.location = storeUrl; }, 300); }
Opera miniでは動作不能