url library Null safety

URL Standard



The interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL. You normally create a new object by specifying the URL as a string when calling its constructor, or by providing a relative URL and a base URL. You can then easily read the parsed components of the URL or make changes to the URL. If a browser doesn't yet support the URL() constructor, you can access a URL object using the Window interface's property. Be sure to check to see if any of your target browsers require this to be prefixed. Note: This feature is available in Web Workers
The interface defines utility methods to work with the query string of a URL. An object implementing can directly be used in a for...of structure to iterate over key/value pairs in the same order as they appear in the query string, for example the following two lines are equivalent: [for (const key, value of mySearchParams) {} for (const key, value of mySearchParams.entries()) {} ] Note: This feature is available in Web Workers