可以强制在浏览器中打开链接而不是在 WebView 中吗?

huangapple go评论44阅读模式
英文:

Can I force a link to open in a browser instead of webview?

问题

我们正在在YouTube和Facebook上推广我们的服务。

我们注意到,当用户进入Facebook后,点击我们网站的链接后,Facebook会打开一个Web视图来显示我们的网站,而不是启动Chrome或Firefox浏览器。

我们希望链接在浏览器中打开,而不是在Web视图中,因为当浏览器打开时,使用Chrome的用户已经登录,他们可以轻松使用基于Google登录系统的服务。

当使用Web视图时,就好像他们在隐身模式下一样。他们必须先登录到Google,然后才能访问我们的服务...

因此,我们失去了90%的用户。

当用户来自YouTube时,YouTube会直接打开Chrome,用户已经登录,可以更快地访问我们的服务。

请问如何强制链接在浏览器中打开我们的网站,而不是在Web视图中?

谢谢。

英文:

We are pushing ads on Youtube and Facebook of our service.

We have noticed that, when users comes Facebook, after clicking on the link of our website, Facebook opens a webview to display our website, instead of launching chrome or firefox.

We wanted the link to open the browser instead of a webview because, when the browser is opened, users using Chrome are logged in and it is easy for them to use our service based on Google login systems.

When it is the webview, it is like if their are in incognit mode. They have to login first to Google, before accessing our service...

As conquence, we loose 90% of our users.

When users comes from Youtube for example, Youtube opens directly chrome, users are already logged in and access our services faster.

Please how could we force a link to open our site in a browser instead of webview ?

Thanks.

答案1

得分: 0

一个应用程序能否在外部视图中打开链接的能力取决于应用程序是否覆盖了WebViewClient。根据源代码注释所述

"在当前WebView加载URL之前,给主机应用程序一个机会接管。如果没有提供WebViewClient,默认情况下,WebView将请求Activity Manager选择URL的正确处理程序"。

因此,如果在应用程序中覆盖了默认的WebViewClient,并且显示在嵌入的WebView中配置,则在单击链接时无法实现在外部视图中打开链接的行为。

英文:

The ability of an application to open links in an external view depends on whether the application has overridden WebViewClient. As the source code comment says:

"Give the host application a chance to take control when a URL is about to be loaded in the current WebView. If a WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the URL".

Thus, if the default WebViewClient is overridden in the application, and the display is configured in the embedded WebView, then you will not be able to achieve the behavior of opening a link in an external view when clicking on a link

huangapple
  • 本文由 发表于 2023年5月7日 00:52:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76190077.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定