Skip to content Skip to sidebar Skip to footer

Delight-im Advanced Webview Send Custom Headers With Every Get & Post Request

I am using delight-im/Android-AdvancedWebView for loading a url with extra headers (user auth token), but the headers are sending only with the initial request, that is the first u

Solution 1:

You can add the following code:

mWebView.setWebViewClient(newWebViewClient(){
    @OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url, getExtraHeaders());
        returntrue;
    }
});

where getExtraHeaders() returns a Map<String, String> containing the additional headers to be used in the HTTP request for this URL.

Also, please note that addHttpHeader has been fixed now and sends custom headers with every GET request.

Post a Comment for "Delight-im Advanced Webview Send Custom Headers With Every Get & Post Request"