htmx
htmx copied to clipboard
Normalise history cache key URLs, and prevent collisions in boosted anchors that use relative links.
-
Since LocalStorage is bound to the origin (domain/protocol/port triplet), we can normalize the URL format used as a key for a history snapshot to reduce cache misses for the same URL referenced differently. E.g.:
https://mysite.com/about,/aboutand/about/are normalized to/about. -
Prevent potential key collisions in boosted relative links, by converting the href to a fully resolved root-relative path. E.g. a boosted anchor
shoe.htmlin the directoryproductsbecomes/products/shoe.html.