【发布时间】:2019-12-31 07:31:06
【问题描述】:
我需要设计一个包含按钮的 HTML 页面。按钮单击事件必须处理以下功能。
- 如果已安装应用,请打开相应的应用。
- 如果未安装应用,请打开 google play 商店链接。
有没有办法让我们打开已经安装的应用,或者带用户去玩商店安装应用?
HTML 代码:
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
window.location.href = "https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=ticketnew.android.ui&hl=en";
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript android html