Skip to main content
Version: 3.27.2

Response.redirect()

The redirect() static method of the Response interface returns a Response resulting in a redirect to the specified URL.

Syntax

Response.redirect(url)
Response.redirect(url, status)

Parameters

  • url
    • : The URL that the new response is to originate from.
  • status optional
    • : An optional status code for the response (e.g., 302.)

Return value

A Response object.

Exceptions

  • RangeError
    • : The specified status is not a redirect status.
  • TypeError
    • : The specified URL is invalid.