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 11 var p = performance.getEntriesByType("resource"); 12 for (var i=0; i < p.length; i++) { 13 var value = "nextHopProtocol" in p[i]; 14 if (value) 15 transport_protocol = p[i].nextHopProtocol; 16 } 17 } 18 19 if (transport_protocol === "h2") 20 document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">"; 21}, false);