kaven-basic - v6.0.0
    Preparing search index...

    Function RemoveQueryParametersFromURL

    • Removes one or more specified query parameters from a given URL.

      Parameters

      • url: string

        The URL string from which to remove query parameters.

      • ...names: string[]

        The names of the query parameters to remove. Accepts one or more parameter names.

      Returns string

      The URL string with the specified query parameters removed. If no parameter names are provided, returns the original URL.

      • The function preserves the URL hash fragment (if present).
      • Parameter names are automatically encoded using encodeURIComponent.
      • If a parameter appears multiple times, all occurrences are removed.
      • The function does not mutate the original URL string.
      RemoveQueryParametersFromURL('https://example.com/page?foo=1&bar=2#section', 'foo');
      // Returns: 'https://example.com/page?bar=2#section'

      4.0.0

      2021-12-11