Skip to main content

toRelativeUrl

Callable

  • toRelativeUrl(url: URL): string

  • Returns a string representing the path, query, and fragment of the given URL.

    @example
    const url = new URL('http://example.com/foo/bar?baz=qux#quux');
    toRelativeUrl(url); // '/foo/bar?baz=qux#quux'

    Parameters

    • url: URL

      The URL.

    Returns string

    The path, query, and fragment.