A URL identifies a web resource or navigation destination. It is also part of an app’s user experience: a readable URL is easier to trust, share, bookmark, and use as a deep link. section 2.1.2 section 2.3.3
The parts of a URL have different jobs:
- The protocol, host, and port identify an origin, which is a browser security boundary. A different origin is cross-origin; a different registrable domain is cross-site. section 2.1.2
- The path identifies a location within the host. A query after ? carries key/value parameters, such as ?id=1&sort=asc. section 2.1.2
- A fragment after # can target a place in a document. A text fragment beginning #:~:text= can highlight specific text. section 2.1.2
Read a URL
In https://firt.dev/notes/pwa#android, HTTPS is the protocol, firt.dev is the host, 443 is the implicit port, /notes/pwa is the path, and android is the fragment. section 2.1.2
For application routes, use descriptive paths and put shareable UI state in the query string when needed. Reserve the hash for document fragments rather than primary routing. Represent internal destinations with real <a href> links so they remain accessible, crawlable, bookmarkable, and easy to open in a new tab. If an app handles navigation on the client, its server must still return the entry HTML for valid deep links without swallowing asset requests, API requests, or real 404 responses. section 10.5
