Android WebView 协议处理程序
我正在尝试使用 WebView 开发 Android 浏览器应用程序,该应用程序使用户能够从自定义协议访问内容。自定义协议可以是 foobar://
我想拦截对此自定义协议的所有请求。这意味着:
- GET 请求
- POST 请求
,我需要能够将这些操作的结果返回给 WebView。
可以使用 shouldInterceptRequest(从 API 级别 11 开始可用)。
现在我的问题是:如何感知并处理POST请求?
此处和<提出了几乎相同的问题a href="https://stackoverflow.com/questions/3664440/android-how-to-intercept-a-form-post-in-android-webviewclient-on-api-level-4">此处 ,但是没有他们的问题已经找到解决办法。
I am trying to develop an Android browser application using WebView which enables users to access content from a custom protocol. The custom protocol could be foobar://
I want to intercept all requests to this custom protocol. This means:
- GET requests
- POST requests
and I need to be able to hand the results of these operations back to the WebView.
The GET requests can be handled using shouldInterceptRequest (available from API level 11).
Now my problem is: How can I incercept and handle POST requests?
Nearly the same question has been asked here and here, however no solutions for their problems have been found.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过重写 post 方法,执行以下操作:
这只是一个想法。这也许可以帮助你。
have you tried overriding for the post method doing something like:
its just an idea. that maybe could help you.