1document.addEventListener("DOMContentLoaded", function() { 2 3 var transport_protocol = ""; 4 5 if (performance && performance.timing.nextHopProtocol) { 6 transport_protocol = performance.timing.nextHopProtocol; 7 } else if (window.chrome && window.chrome.loadTimes) { 8 transport_protocol = window.chrome.loadTimes().connectionInfo; 9 } else { 10 var p = performance.getEntriesByType("resource"); 11 for (var i = 0; i < p.length; i++) { 12 var value = "nextHopProtocol" in p[i]; 13 if (value) 14 transport_protocol = p[i].nextHopProtocol; 15 } 16 } 17 18 if (transport_protocol === "h2") 19 document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">"; 20 21}, false); 22