I want the user to be able to enter their website URL into an input box that is part of a Chrome Extension and the Chrome extension will use an AJAX request or something similar to detect and tell the user if the server behind the URL supports sending responses via HTTP2. Is this possible?
Maybe the WebRequest has a way of picking up this information? Or the new Fetch API? Could your request tell the server somehow that only HTTP2 replies are understood? I can't see an obvious way.
I know you can use window.chrome.loadTimes().connectionInfo
to get the protocol of the current page but this requires loading the whole page which I don't want to do.
Example URLS:
Delivered over HTTP2: https://cdn.sstatic.net/
Delivered over HTTP 1.1: https://stackoverflow.com/
"all_frames": true
in manifest) and send a message with chrome.loadTimes().connectionInfo to your background/popup script. – Pantaletstabs.executeScript()
would be much more appropriate than a manifest.jsoncontent_scripts
entry. The only way to use a manifest.jsoncontent_scripts* entry here would be to have it load into
<all_urls>`, which would be an inappropriate burden to place on every single page and frame the user opens. Other than that, the general concept behind the approach appears viable (various refinements, more appropriate for an answer than comments, suggest themselves). – Covin