/

HTML / CSS / JavaScript Tutorial

JavaScript Location method: replace()

[this page | pdf | back links]

The replace() method (when applied to Location objects in the JavaScript BOM) replaces the current document with a new document (in a way that removes the URL of the current document from the document history, so stopping the back button of the browser going back to the original document).

 

It has the following syntax with the following parameters. It does not return a value.

 

location.replace(URL)

 

Parameter

Required / Optional

Description

URL

Required

URL of page to navigate to

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile