Skip to main content

useNormalizedUrl

export
function useNormalizedUrl(
  initialUrl: string
) : string

This hook transforms relative and protocol-relative URLs to absolute URLs as per RFC1808. The base URL is determined by the <base /> element, source.uri or source.baseUrl.

Remarks
  • If there is no baseUrl and the initial URL is relative, this hook will return the initial URL.
  • If the initial URL is absolute, this hook will return this initial URL.

Parameters#

initialUrl#

required
initialUrl: string;

The URL before normalization.