user331914
user331914

Reputation:

document.location

How do you use document.location? Is it HTML or in JS? Please help me out!

Upvotes: 4

Views: 26881

Answers (3)

loviji
loviji

Reputation: 13080

document is a DOM element. to access it you can use javascript or dom api.

Upvotes: 1

Pranay Rana
Pranay Rana

Reputation: 176896

The JavaScript location object is a property of the window object. It can be used to control the web page displayed by the browser.

More methods and property : http://www.comptechdoc.org/independent/web/cgi/javamanual/javalocation.html

reload() - The current window document is reloaded. If a value of true is passed to the reload function, the reload is forced to do an HTTP GET of the document. This is not normally done but is useful when you think the server contents may be different from your cache.

replace(URL) - Requires a URL as a parameter. It loads the document at the URL on top of the current document. A new entry entry is not placed in the history object.

Upvotes: 1

Mitch Dempsey
Mitch Dempsey

Reputation: 39889

It is javascript.

document.location.href="http://www.google.com"; would redirect you go google

Upvotes: 9

Related Questions