Latest web development tutorials

Location assign () method

Location Object Reference Location Object

Definition and Usage

assign () method to load a new document.

grammar

location.assign(URL)


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support assign () method


Examples

Examples

Using the assign () to load a new document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function newDoc(){
    window.location.assign("http://www.w3big.com")
}
</script>
</head>
<body>

<input type="button" value="载入新文档" onclick="newDoc()">

</body>
</html>

try it"


Location Object Reference Location Object