document.location

In this chapter you will learn:

  1. How to get the document location in Javascript

Document location

document.location gets the URL of the current document. The return type is Location.

<!DOCTYPE HTML> <!--  j  a  v  a  2s .  co m-->
<html> 
    <body> 
        <script> 
            document.writeln(document.location); 
        </script> 
    </body> 
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. How to get information about the implementation of the DOM features
Home » Javascript Tutorial » Document
Document Object
document.body
document.characterSet
document.charset
document.compatMode
document.cookie
document.defaultCharset
document.defaultView
getElementsByTagName(tagName)
document.getElementsByClassName
document.getElementsByName
document.images
document.lastModified
document.location
document.implementation
document.querySelectorAll
document.readyState
document.title
document.URL
document.writeln