How to detect if the visitor is using HTTP/2 or SPDY

Multi tool use
Multi tool use


How to detect if the visitor is using HTTP/2 or SPDY



Hi guys I am searching for a script which can detect if the visitor's browser has enabled SPDY or HTTP/2.



Something like this https://www.ist-http2-aktiviert.de/




3 Answers
3



Theoretically, once nextHopProtocol lands in ResourceTiming and NavigationTiming, you should be able to detect h2 support for the root page and other resources.


nextHopProtocol


h2



As of 2016-06-06, nextHopProtocol is only available in Firefox's ResourceTiming implementation. It is not available in their NavigationTiming, or in either NavigationTiming nor ResourceTiming for Chrome, FF, and Safari.


nextHopProtocol



So for Firefox visitors today, you could see if nextHopProtocol is h2 for other resources on the same domain as the HTML page, and infer that the HTML page is h2 as well.


nextHopProtocol


h2


h2





Chrome does have this too as of 2018.
– DanFromGermany
May 7 at 9:14





Chrome has it as of Jul 2018: performance.getEntriesByType('navigation')[0].nextHopProtocol
– Punit S
Jul 3 at 8:42




I didn't find a straightforward test. i think a workaround would be to write your own test :)
You can get a list of browsers that support HTTP/2 (can be found on caniuse.com) then loop through the list of supporting browsers, if the current browser serving you is in the list then you are good to go.



It is July, 2018 and I see both Firefox and Chrome exposing this through Navigation Timing 2 API:


performance.getEntriesByType('navigation')[0].nextHopProtocol



That being said, Navigation Timing Level 2 API is currently in working draft status so support for the nextHopProtocol (which is being introduced with Level 2 API) will be limited (unsure of exact browsers supporting it since caniuse currently doesn't include Navigation Timing Level 2 API).






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

b91D,se0fNZehk,aN5K3 MlSmg A iZd79QQ1G7SgFa,FR,dsr0GSIFwrzggsF O2l7bxPnE,TcZ2 1,2e WQhKN5,37Vdp
GDp9Ws6DE

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications