Location assign()
Passing in a URL to locatoin.assign() method starts the process of navigating to the new URL and makes an entry in the browser's history stack.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script>
document.location.assign("http://java2s.com");
</script>
</body>
</html>