Search w3schools.com:

SHARE THIS PAGE

Location assign() Method

Location Object Reference Location Object

Definition and Usage

The assign() method loads a new document.

Syntax

location.assign(URL)


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

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


Example

Example

Load a new document:

<html>
<head>
<script>
function newDoc()
  {
  window.location.assign("http://www.w3schools.com")
  }
</script>
</head>
<body>

<input type="button" value="Load new document" onclick="newDoc()">

</body>
</html>

Try it yourself »


Location Object Reference Location Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]