启动精简版浏览器

发布于 2024-08-26 06:08:42 字数 156 浏览 5 评论 0原文

抱歉这个标题,我无法争论更好的东西。

我的问题是:是否可以在 Android 上启动浏览器并且不提供更改页面的选项?

例如,如果我启动浏览器访问 stackoverflow.com,我希望用户在该网站上导航,但不提供访问另一个网站的能力。

这可行吗?

Sorry for the title, I couldn't argue something better.

Here is my question: Is it possible to launch a browser on Android and don't give the option to change page?

For instance, if I launch a browser to stackoverflow.com, i want the user to navigate on the site, but don't give the ability to go to another site.

Is this feasible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情废物 2024-09-02 06:08:42

可行的方法是 WebView

WebView 有几个您可以在其中添加自己的行为的自定义点。它们是:

  • 创建和设置 WebChromeClient 子类。当发生可能影响浏览器 UI 的事件时调用此类,例如,在此处发送进度更新和 JavaScript 警报。
  • 创建并设置 WebViewClient 子类。当发生影响内容呈现的事情时(例如错误或表单提交),它将被调用。您还可以在此处拦截 URL 加载。
  • 通过 WebSettings 类,其中包含各种配置。
  • 使用 addJavascriptInterface(Object, String) 方法。这使您可以将 Java 对象绑定到 WebView 中,以便可以从网页 JavaScript 控制它们

The way to go is WebView

A WebView has several customization points where you can add your own behavior. These are:

  • Creating and setting a WebChromeClient subclass. This class is called when something that might impact a browser UI happens, for instance, progress updates and JavaScript alerts are sent here.
  • Creating and setting a WebViewClient subclass. It will be called when things happen that impact the rendering of the content, eg, errors or form submissions. You can also intercept URL loading here.
  • Via the WebSettings class, which contains miscellaneous configuration.
  • With the addJavascriptInterface(Object, String) method. This lets you bind Java objects into the WebView so they can be controlled from the web pages JavaScript
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文