I have met a problem when I capture the http package when my webView visit a url. the package shows that the request send by ajax has a 'X-requested-with' key in the headers, which has the value of my app package name like 'com.xxx'. I don't want the url I visited to know the request came from my app, so I need to replace the key 'X-requested-with' to another value.but I tried the sloution in Add custom headers to WebView resource requests - android, all of them do not work.
loadUrl(Strring url, Map<String, String> extraHeaders)
will be called only in the page request, not in the resource request send by ajax.shouldOverrideUrlLoading(WebView view, String url)
and WebViewClient.shouldInterceptRequest(android.webkit.WebView view, java.lang.String url)
will be called in every request, but I can't modify headers in them.
So any solutions to the question? Thank you so much.