添加自定义标头的WebView资源请求 - 机器人 [英] Add custom headers to WebView resource requests - android
本文介绍了添加自定义标头的WebView资源请求 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要自定义标题添加到每个请求的web视图到来。我知道使用loadURL
有参数 extraHeaders
,但这些只适用于初始请求。所有后续请求不包含标头。我在 WebViewClient
看着都覆盖,但没有允许添加标题,以资源请求 - onLoadResource(web视图查看,字符串URL)
。任何帮助将是美好的。
I need to add custom headers to EVERY request coming from the WebView. I know loadURL
has the parameter for extraHeaders
, but those are only applied to the initial request. All subsequent requests do not contain the headers. I have looked at all overrides in WebViewClient
, but nothing allows for adding headers to resource requests - onLoadResource(WebView view, String url)
. Any help would be wonderful.
谢谢, 雷
推荐答案
尝试
loadUrl(String url, Map<String, String> extraHeaders)
不幸的是这仅适用于API8 +。
Unfortunately this only works on API8+.
这篇关于添加自定义标头的WebView资源请求 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文