- In the above definition, "single connection from browsers to a Web site". What does it mean? Because we can open multiple instances of a website from a browser.
That you have multiple instances of a website handled in a browser, doesn't imply you need multiple underlying connections.
- While writing an API, how can I specify that HTTP/2 protocol should be invoked?
You can't force the usage of the HTTP/2 protocol from a browser, since it's the client that initiates the connection handshake.
References:
- Microsoft Edge force HTTP/2 usage
- What if an HTTP/1.1 client talk to an HTTP/2 only server and what if an HTTP/2 client talk to an HTTP/1.1 only server?
- When we say the HTTP/2 protocol. Does it include HTTP also or it's just the term for new protocol only?
No, these protocols are entirely different. The latter reference answers this (emphasis mine):
"A browser that only supports HTTP/2" does not exist; if they support HTTP/2, they also support HTTP/1.1. But let's assume that such browser exist.
In this latter case, the server will see the connection preface and will not recognize the PRI method. What exactly the server does in this case depends on the server. It may return a 400 Bad Request, or perhaps just close the connection, or it may trigger an internal server error.
Nowadays you can fairly assume that all modern browsers use the HTTP/2 protocol for sake of speed and saving ressourcesresources.
Also why do you think that would be important for building a HTTP based API?
API's based on HTTP (e.g. webservices based on SOAP, REST, etc.) use that as a transport service, and should be entirely agnostic about the transport layers details.