Planning to use chrome custom tabs, however before I start I wanted to know if its possible to intercept the request and set any headers in the request similar to WebViews ?
Read through the documentation and could not find any examples or references. All I could find is the onNavigationEvent callback that tells what url browser is trying to load.
Also is it possible to stop navigation for any url if required ?
In the Home pane, double-click HTTP Response Headers. In the HTTP Response Headers pane, click Add... in the Actions pane. In the Add Custom HTTP Response Header dialog box, set the name and value for your custom header, and then click OK.
Custom HTTP headers can be used to filter requests or specify a value for the Accept header.
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);
I managed to inject http headers for the first tab following this way: https://medium.com/@_rpiel/chrome-custom-tabs-and-headers-or-a-happy-open-source-story-9c3f82680eea#.l46alsivf
I don't think that it's supported for subsequent tabs for now.
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