简体   繁体   English

我如何在移动浏览器中提示本机应用程序安装

[英]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.

相关问题 如何将本地Android操作栏添加到我的Air Mobile应用程序? - How can I add a native Android action bar to my Air Mobile app? 如何强制网页脱离本机移动应用程序? - How can I force a web page to break out of a native mobile app? 由于 avd 太慢,我如何在我的手机上运行 react-native 应用程序 - How Can I run react-native app in my mobile because avd is too slow 如何解决 flutter web 应用程序的移动浏览器上的白屏问题? - How do I resolve white screen on mobile browsers for flutter web app? 如何在 android 应用程序中提示文件管理器进入已知路径? - How I can prompt a file manager into a known path in an android app? 如果我使用ReactJS创建一个Web应用程序,我可以重用代码来构建一个使用React Native的移动应用程序吗? - If I create a web app with ReactJS, can I reuse the code to build a mobile app with React Native? 如何将 web 站点放入移动原生应用程序? - How can I put a web site into a mobile native application? 如何防止未经授权的用户安装我的 android 应用程序? - How can I prevent installation of my android app by unauthorised users? 如何防止在手机中安装Android应用程序? - How I can prevent installation of my android app in phones? 防止身体滚动(移动、本机浏览器) - Prevent body from scrolling (mobile, native browsers)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM