查明 Android 浏览器是在应用程序中运行还是自行运行
我正在使用 的混合 Android 应用程序间歇泉。 我想告知用户,如果他进入我网站的移动版本,就可以下载此应用程序。问题是,应用程序中运行的浏览器可以查看与移动网站几乎相同的内容。
如果我在应用程序浏览器中运行而不是在普通浏览器中运行,如何使用 JS 进行检测? 我不想在应用程序中显示该应用程序的下载链接。
谢谢
I am using an hybrid android app from geyser.
I want to inform the user about the possibility to download this app, if he enters the mobile version of my website. the thing is, in the app runs a browser which views almost the same content as the mobile website.
how can I detect with JS if I am running in the App-Browser and not on the normal Browser?
I don't want to show the download Link of the App in the App.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以做的是在你的页面上有一个 javascript 函数
,然后,当你通过 android 版本加载你的网站时(假设你使用的是 Android WebView class ),您可以通过以下方式在加载页面时运行该函数,
在这种情况下,您将拥有
isAndroidApp 设置为
true
其余的代码(如果可以从 Android 应用程序中看到)。What you could do is have a javascript function on your page like
and then, when you load your site through the android version (assuming you're using the Android WebView class ), you could make the function run when loading the page in the following manner
in which case, you'd have
isAndroidApp
set totrue
for the rest of your code if it's seen from the android app.