flâneur — a map of the web's best reading

How to Parse URL in JavaScript: hostname, pathname, query, hash

dmitripavlutin.com · 1,015 words · saved by 1 readers

How to easily parse URL in JavaScript and access components like hostname, pathname, query, or hash.

How to Parse URL in JavaScript: hostname, pathname, query, hash Updated January 29, 2023 javascript url -- Comments A Uniform Resource Locator, abbreviated URL , is a reference to a web resource (web page, image, file). The URL specifies the resource location and a mechanism to retrieve the resource (http, ftp, mailto). For example, here's the URL of this blog post: https://dmitripavlutin.com/parse-url-javascript Often you need to access specific components of an URL: the hostname (e.g. dmitripavlutin.com ), or pathname (e.g. /parse-url-javascript ). A convenient parser to access components of

Explore this link on the map →

saved by

related reading