2019-04-05 21:13:59 +08:00
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
var transport_protocol = "";
|
|
|
|
|
|
|
|
if ( performance && performance.timing.nextHopProtocol ) {
|
|
|
|
transport_protocol = performance.timing.nextHopProtocol;
|
|
|
|
} else if ( window.chrome && window.chrome.loadTimes ) {
|
|
|
|
transport_protocol = window.chrome.loadTimes().connectionInfo;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var p = performance.getEntriesByType("resource");
|
|
|
|
for (var i=0; i < p.length; i++) {
|
|
|
|
var value = "nextHopProtocol" in p[i];
|
|
|
|
if (value)
|
|
|
|
transport_protocol = p[i].nextHopProtocol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-02 08:32:23 +00:00
|
|
|
if (transport_protocol === "h2")
|
2019-04-05 21:13:59 +08:00
|
|
|
document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">";
|
|
|
|
}, false);
|