<分区>
Possible Duplicate:
iPhone Safari: check if URL scheme is supported in javascript?
我正在使用 pic2shop为移动网络应用程序提供条形码扫描。对于 iOS,可以检查 [canOpenURL] 以查看特定方案是否有效(tel://、pic2shop://)。移动浏览器(iOS、Android 等)中是否有提供相同功能的内容?
<分区>
Possible Duplicate:
iPhone Safari: check if URL scheme is supported in javascript?
我正在使用 pic2shop为移动网络应用程序提供条形码扫描。对于 iOS,可以检查 [canOpenURL] 以查看特定方案是否有效(tel://、pic2shop://)。移动浏览器(iOS、Android 等)中是否有提供相同功能的内容?
最佳答案
您可以尝试将该 URL 放入 iframe
中并等待几秒钟。如果您没有被重定向到某个应用,则表示该应用尚未注册。
setTimeout(function() {
alert('It seems that your device does not support our feature.');
}, 1000);
document.write('<iframe style="border:none; width:1px; height:1px;" src="pic2shop://"></iframe>');
关于javascript - 是否有类似于 iOS 的 canOpenURL 的东西来检查移动浏览器的 URL 方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6065423/