To initiate a preconnect, the user agent must run these steps:
- Resolve the URL given by the href attribute.
- Let origin be preconnect URL's origin.
- Let corsAttributeState be the current state of the element's crossorigin content attribute.
- Let credentials be a boolean value set to true.
- If corsAttributeState is Anonymous and origin is not equal to current Document's origin, set credentials to false.
- Attempt to obtain connection with origin and credentials.
The optimal number of connections per origin is dependent on the negotiated protocol, users current connectivity profile, available device resources, global connection limits, and other context specific variables. As a result, the decision for how many connections should be opened is deferred to the user agent.