简体   繁体   English

在移动设备上检测应用内(webView 或 mini)浏览器

[英]Detect in-app (webView or mini) browser on mobile

I have an Angular 9 app.我有一个 Angular 9 应用程序。 I want to show some message when user open it on gmail in-app browser.当用户在 gmail 应用程序内浏览器上打开它时,我想显示一些消息。 I did't find a way difference between gmail in-app browser and Safari on iPhone.我没有发现应用内浏览器 gmail 和 iPhone 上的 Safari 之间的区别。 I've tried those approaches: detect ipad/iphone webview via javascript , check for indexeddb, Navigator.canShare() and they didn't help.我已经尝试过这些方法: 通过 javascript 检测 ipad/iphone webview ,检查 indexeddb、Navigator.canShare(),它们没有帮助。 navigator.userAgent are same on those browsers. navigator.userAgent 在这些浏览器上是相同的。 Please help to find differences.请帮忙找出不同之处。

@maksym 您是否希望在 Gmail IOS 应用程序的网络驱动程序中打开您的网站时区分用户会话?

On iPhone, the viewport height is slightly different (iPhone 8: 1445 in Safari, 1461 in Gmail).在 iPhone 上,视口高度略有不同(iPhone 8:Safari 中为 1445,Gmail 中为 1461)。

If:如果:

  1. user email domain is Gmail用户电子邮件域是 Gmail
  2. iOS mobile user agent match iOS 移动用户代理匹配
    • Gmail viewport size match (different per device) Gmail 视口大小匹配(每个设备不同)
      • assume user is in Gmail app假设用户在 Gmail 应用程序中
      • show interstitial page prompting user to click Safari link in bottom right, & also smaller sized link warning to 'Continue in Gmail app' if you want.显示插页式页面,提示用户单击右下角的 Safari 链接,如果需要,还会显示“在 Gmail 应用程序中继续”的较小链接警告。

Note: This would not work for custom domains, or you would have to map them somehow.注意:这不适用于自定义域,或者您必须以某种方式映射它们。

You might consider promoting the Add To Home Screen (ATHS) process prior to the user completing registration.您可以考虑在用户完成注册之前促进添加到主屏幕 (ATHS) 过程。 As long as it's optional and doesn't really block the user from completing registration itself, you have nothing to lose.只要它是可选的并且不会真正阻止用户自己完成注册,您就没有什么可失去的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM