Location assign() Method
Location Object
Example
Load a new document:
location.assign("http://www.w3schools.com");
Try it yourself »
Definition and Usage
The assign() method loads a new document.
The difference between this method and
replace(), is that replace() removes the URL of the current document from
the document history, meaning that it is not possible to use the "back" button
to navigate back to the original document.
Browser Support
| Method |
|
|
|
|
|
| assign() |
Yes |
Yes |
Yes |
Yes |
Yes |
Syntax
Parameter Values
| Parameter |
Type |
Description |
| URL |
String |
Required. Specifies the URL of the page to navigate to |
Return Value
Location Object