[英]How can i prompt native app installation in mobile browsers
Hi i want to display a banner in mobile browser to prompt user to download the app from the store (either Google play or Apple).您好,我想在移动浏览器中显示横幅以提示用户从商店(Google Play 或 Apple)下载应用程序。 An example is the following Example banner一个例子是下面的例子横幅
For IOS i found this .对于 IOS,我找到了这个。 It seems it works only for safari browser.它似乎只适用于 safari 浏览器。 Is there any way to implement it for other browsers too?有没有办法为其他浏览器实现它?
For Android i found this .对于 Android,我找到了这个。 It is for PWA.它适用于 PWA。 I tried to implement it in our website (not PWA) but nothing was displayed.我试图在我们的网站(不是 PWA)中实现它,但没有显示任何内容。
Is there any way to work in both OSes and in all latest browsers?有什么方法可以同时在操作系统和所有最新的浏览器中工作吗? If there isn't, how can i get the rating, latest icons and check if it is supported in the country?如果没有,我如何获得评级,最新图标并检查它是否在该国家/地区受支持?
Another alternative is smartbanner.js , ~13 KB, no jQuery or other dependencies.另一种选择是smartbanner.js ,~13 KB,没有 jQuery 或其他依赖项。
Easy to set up based on a dozen of meta tags, but also has API for more complex scenarios.基于十几个元标记易于设置,但也有 API 用于更复杂的场景。
Smart App Banner for iOS iOS 的智能应用横幅
In order to display the banner whenever a visitor opens your web using an iOS device (iPhone, iPod or iPad) you only need to include the following line within the head element of your HTML code:为了在访问者使用 iOS 设备(iPhone、iPod 或 iPad)打开 web 时显示横幅,您只需在 HTML 代码的 head 元素中包含以下行:
<meta name="apple-itunes-app" content="app-id=myAppStoreID">
Smart App Banner for Android Android 的智能应用横幅
There is no native support on Android for Smart App Banners, but you can use a jQuery plugin instead. Android 不支持智能应用横幅,但您可以使用 jQuery 插件代替。
First, download the plugin and upload to your server jquery.smartbanner.css and jquery.smartbanner.js.首先,下载插件并上传到您的服务器 jquery.smartbanner.css 和 jquery.smartbanner.js。
Then, you need to include two fragments of code.然后,您需要包含两个代码片段。 The first one within the head element: head 元素中的第一个:
<meta name="google-play-app" content="app-id=com.package.android">
<link rel="stylesheet" href="/path/a/jquery.smartbanner.css" type="text/css"
media="screen">
The second piece of code has to be included at the end of the body.第二段代码必须包含在主体的末尾。
<!-- copy body -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js">.
</script>
<script src="/path/a/jquery.smartbanner.js"></script>
<script type="text/javascript">
$().smartbanner();
</script>
<!-- end copy body -->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.