简体   繁体   中英

How to know if a request is performed using HTTP 1.x or HTTP2

I want to know if a request between a JavaScript Client and Node.js server is performed using HTTP1.x or HTTP2.

How I know in XMLHttpRequest, Chrome Console and Node.js what type of protocol is used ?

Standard one: performance.timing.nextHopProtocol

Non standard implemetation: window.chrome.loadTimes().connectionInfo

You can check in network tab of dev tools where h2 represents HTTP2,

网络面板中的协议列

When the Protocol column says h2 it means that the resource was sent with HTTP/2. The Protocol column is hidden by default. Right-click the table header and select Protocol to show it. See Show more information for an example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM