[英]Implementation of google places using VueJs in Hybrid mobile application
[英]Vuejs - Check if mobile application is installed or not
我正在开发一个 Web 应用程序。 我在哪里检查过链接是在移动设备还是笔记本电脑上打开的。
consider the link to be: my-site.com
现在我的网站在 android 和 ios 上也有一个移动应用程序。 如果安装了 android 应用程序并且我单击了一个名为“开始”的按钮,它会在移动应用程序中打开该链接。
我想要达到的目标:
我想要实现的是,如果未安装 android 应用程序并单击“开始”按钮,则它应该打开该应用程序的 Playstore 链接,如果安装了该按钮,该按钮将转到该应用程序。
当前方法:
我已经检查了 device=mobile 和设备是 android 打开 android 应用程序和设备是 ios 打开 ios 链接的位置,但是如果未安装应用程序,如何打开 Playstore/应用程序商店。
您可以检查浏览器的 userAgent 并添加到 Playstore 的链接。 如果安装了该应用程序,它将打开该应用程序,否则将打开本机设备的 Playstore。
将此功能添加到按钮的点击事件中:
...
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
window.location.href =
'http://play.google.com/store/apps/details?id=PACKAGEURL';
}
if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1){
window.location.href =
'http://itunes.apple.com/lb/app/PACKAGEURL';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.