【发布时间】:2018-06-14 04:51:01
【问题描述】:
我正在尝试从 javascript 打开一个 android 应用程序。如果 android 应用程序安装在 android mobile 中,它会打开所需的应用程序。但是如果没有安装android应用程序,它应该给我一个弹出窗口,“你似乎没有安装应用程序,你想现在下载吗?”。但我收到 net::ERR_UNKNOWN_URL_SCHEME 错误。我在下面添加了代码sn-p:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
function redirectToApp() {
$('#link').attr('href', "<scheme>://<package>/?<parameters>");
$("#link")[0].click();
setTimeout(
function() {
if (confirm('You do not seem to have app installed, do you want to download it now?')) {
window.location = 'https://play.google.com/store/apps/details?id=123';
}
}, 500);
}
</script>
</head>
<body onload="redirectToApp()">
<a id="link" href="" style="display: none">Link</a>
</body>
</html>
【问题讨论】:
标签: javascript android spring-mvc web okta