assign method

In this chapter you will learn:

  1. How to use assign method to location object

Assign value to location

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> <!--   j a  va 2s .  co m-->
<html> 
    <body> 
        <script> 
             document.location.assign("http://java2s.com"); 
        </script> 
    </body> 
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. How to use Location.hash property
Home » Javascript Tutorial » Location
Location
assign method
Location.hash
Location.hostname
Location.href
location.pathname
location.port
location.reload
location.replace()
Location.search