如何使网络链接直接在Google Play商店中打开

时间:2020-02-28 20:45:06

标签: javascript android webview google-play blogger

我有一个使用模板的博客网站www.aplitechstore.com.br, 我们添加了许多应用程序链接以在Google Play上下载,但这些链接未在Google Play商店应用中打开,而是在网站上打开。 我想要更改它,我希望我们的应用程序和网站(以Webview模式)在单击链接后,在Google Play商店应用程序中打开。

1 个答案:

答案 0 :(得分:1)

As explained here,Google Play提供了网址协议

market://details?id=<package_name>

在Blogger上应用:

将以下javascript代码放在</body>的底部和前面。这只会更改Android上的Google Play链接。

<script>
if (/(android)/i.test(navigator.userAgent)) {
  document.querySelectorAll('a[href]').forEach(function (link) {
    link.href = link.href.replace('https://play.google.com/store/apps/','market://');
  });
}
</script>