With standard Android WebViews, you use WebView.loadUrl(String url, Map<String, String> additionalHttpHeaders)
. How do you add your additional headers with Chrome Custom Tabs?
Select the web site where you want to add the custom HTTP response header. In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name.
I'm not sure if you can send headers or anything related to the http request besides the url. I hope future versions will allow sending headers in Bundle
when you establish CustomTabSession
or so.
Entire http call is managed in CustomTabActivity
.
Edit:
As of recent updates of the library, you can now add Bundle
and pass it to the CustomTabsIntent
intent as extra with key Browser.EXTRA_HEADERS
Bundle headers = new Bundle();
headers.putString("header1", "value1");
headers.putString("header2", "value2");
customTabsIntent.intent.putExtra(Browser.EXTRA_HEADERS, headers);
The above mentions solutions won't work for new version of ChromeTab
.Please follow this link fix for work around.You can also study the medium post by Romain Piel which implicitly states the usage and the work around for adding headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With