0

I am working on an Application which requires Chrome Custom Tabs, So far i am able to Pre-fetch HTML/CSS of a Single Url, by creating a CustomTabSession and with the help of mayLaunchUrl

 customTabsSession.mayLaunchUrl(Uri.parse(url), null, null);

How to pre-fetch HTML/CSS for multiple Urls?

Doomers
  • 11
  • 2
  • What mayLaunchURL is doing is not necessarily a prefetch of HTML/CSS. It is something that is supposed to utilize advance knowledg eabout the navigation to speed up loading of the page. So there is no guarantee that all the CSS would be prefetched, for example, so you should not rely on having it available offline. Also, too many mayLaunchURLs that did not result in navigation would be throttled by Chrome. – Egor Pasko Feb 17 '17 at 14:26

1 Answers1

0

If you need a performance improvement for multiple URLs, there is a "low confidence mayLaunchUrl", where as the first argument you provide null, and a list of URLs packed into bundles as |otherLikelyBundles|.

See: https://github.com/GoogleChrome/custom-tabs-client/blob/master/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java#L118

In this case Chrome will attempt to preconnect to the hosts serving those URLs. We have not tested how well this works in practice, please share your findings.

Egor Pasko
  • 506
  • 3
  • 11