且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检测访问者是否使用HTTP / 2或SPDY

更新时间:2023-12-03 10:12:52

理论上,一旦 nextHopProtocol 登陆 ResourceTiming NavigationTiming ,您应该能够检测到对根页面和其他资源的 h2 支持。



nextHopProtocol 仅在Firefox的ResourceTiming实现中可用。它不适用于NavigationTiming,或者NavigationTiming,也不适用于Chrome,FF和Safari的ResourceTiming。因此,对于今天的Firefox访问者,您可以看到 nextHopProtocol 为 h2 ,并推断HTML页面为 h2

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/

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

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.

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.