html調(diào)用起APP
思路:就是用跳轉(zhuǎn)到URL scheme這個地址
偽代碼:
const iframe = document.createElement("iframe");
iframe.src = "URL scheme";
iframe.style.display = 'none';
document.body.appendChild(iframe);
可能會出現(xiàn)代碼調(diào)起失敗的情況,然后這個時候,需要判斷一下
const timer = 1000;
setTimeout(function(){
document.body.removeChild(iframe);
if(Date.now() - last <2000){}else{}
},timer)
iframe被攔截的情況下,我們可以使用window.location.href = URL.scheme做兼容