简体   繁体   English

如何在 Chrome 自定义标签 android 中隐藏 url

[英]How to hide url in Chrome custom tab android

I have implemented new Chrome Custom Tab in android, I am using the following code to open我已经在 android 中实现了新的Chrome 自定义标签,我使用以下代码打开

Uri uri = Uri.parse("https://akash.plobal.com/ploicy");
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();                   
intentBuilder.setToolbarColor(Color.BLACK);
intentBuilder.setShowTitle(true);
intentBuilder.build().launchUrl(getActivity(), uri);

I need to hide url below the title in toolbar我需要隐藏工具栏中标题下方的网址

在此处输入图片说明

If you control both the content and the application, you can use Trusted Web Activities to completely remove the URL bar.如果您同时控制内容和应用程序,则可以使用受信任的 Web 活动来完全删除 URL 栏。 You'll need to implement Digital Asset Links to validate the ownership of both.您需要实施数字资产链接来验证两者的所有权。

If you don't own the content, it is not possible to hide the URL below the title.如果您不拥有该内容,则无法隐藏标题下方的 URL。 The URLs needs to visible to the user, so that they can know in which site they are.这些 URL 需要对用户可见,以便他们知道自己在哪个站点。 By removing this from the UI, a malicious site could mimic the UI of another one, and this could potentially create a security issue for users.通过从 UI 中删除它,恶意站点可以模仿另一个站点的 UI,这可能会给用户带来安全问题。

If you control both the content and the application, you can use Trusted Web Activities to completely remove the URL bar. 如果同时控制内容和应用程序,则可以使用“受信任的Web活动”完全删除URL栏。 You'll need to implement Digital Asset Links to validate the ownership of both. 您需要实施数字资产链接以验证两者的所有权。

If you don't own the content, it is not possible to hide the URL below the title. 如果您不拥有内容,则无法将URL隐藏在标题下方。 The URLs needs to visible to the user, so that they can know in which site they are. 这些URL必须对用户可见,以便他们可以知道它们在哪个站点中。 By removing this from the UI, a malicious site could mimic the UI of another one, and this could potentially create a security issue for users. 通过从UI删除它,恶意站点可能模仿另一个站点的UI,这可能会给用户带来安全问题。

You cannot hide the url alone.您不能单独隐藏网址。 You can only get rid of the whole title bar, that too when the user scroll the view.您只能摆脱整个标题栏,当用户滚动视图时也是如此。 To achieve this,use要实现这一点,请使用

intentBuilder.enableUrlBarHiding(); intentBuilder.enableUrlBarHiding();

您可以尝试自定义选项卡的setShowTitle(false)

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

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