X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Location assign() Method

Location Object Reference 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

Internet Explorer Firefox Opera Google Chrome Safari

The assign() method is supported in all major browsers.


Syntax

location.assign(URL)

Parameter Values

Parameter Type Description
URL String Required. Specifies the URL of the page to navigate to

Return Value

No return value.


Location Object Reference Location Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook