如何检测访问者是否使用HTTP / 2或SPDY [英] How to detect if the visitor is using HTTP/2 or SPDY

查看:207
本文介绍了如何检测访问者是否使用HTTP / 2或SPDY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在寻找一个脚本,它可以检测访问者的浏览器是否启用了SPDY或HTTP / 2。



类似于 https://www.ist-http2-aktiviert.de/

解决方案

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



<截至2016年6月6日, nextHopProtocol 仅在Firefox的ResourceTiming实现中可用。它不适用于NavigationTiming,或者NavigationTiming,也不适用于Chrome,FF和Safari的ResourceTiming。

因此,对于今天的Firefox访问者,您可以看到<$ c对于与HTML页面相同的域上的其他资源,$ c> 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.

这篇关于如何检测访问者是否使用HTTP / 2或SPDY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆