How to determine if the site uses http2 (chrome)
Apr 16, 2022
By using natively availableperformance
APIs:
window
.performance
.getEntriesByType("resource")
.filter(p => 'nextHopProtocol' in p)[0]
.nextHopProtocol // 'h2'
By using the deprecated loadTimes
API:
window.chrome.loadTimes().wasFetchedViaSpdy; // true window.chrome.loadTimes().npnNegotiatedProtocol; // 'h2' window.chrome.loadTimes().connectionInfo; // 'h2'
The deprecation notice can be read here: https://chromestatus.com/feature/5637885046816768
Feature Flag
If you’re in an older machine OR browser, then go to chrome://net-internals/#http2 and open the network observation component, and select HTTP/2
View gist: https://bigfatsoftwareinc.wordpress.com/2022/04/16/how-to-determine-if-the-site-uses-http2-chrome/
Originally published at http://bigfatsoftwareinc.wordpress.com on April 16, 2022.