How to get the document location in Javascript

Document location

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

Example


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

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window