开发者

Launching a reduced browser

开发者 https://www.devze.com 2022-12-24 02:31 出处:网络
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?

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 brow开发者_如何学JAVAser 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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消