location

In this chapter you will learn:

  1. Change the URL location for a window

window.location

Passing in a URL to window.location property starts the process of navigating to the new URL and makes an entry in the browser's history stack.

<!DOCTYPE HTML> <!--from j a v a 2 s .c  om-->
<html> 
    <body> 
        <script type="text/javascript"> 
              window.location = "http://www.java2s.com"; 
        </script> 
    </body> 
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. How to move a window with Javascript
  2. How use negative value to move window to left
Home » Javascript Tutorial » Window
Window Object
alert()
close()
confirm()
find()
Window height and width
location
window.moveBy
window.moveTo
window.open()
window.print()
window.prompt()
resizeTo(x,y) and resizeBy(xDelta,yDelta)
window.scrollTo(x,y)
screenLeft, screenX, screenTop, screenY
setInterval()
setTimeout()