You are here: Reference > JavaScript > client-side > HTML DOM > properties > documentURI (document, XMLDocument)

documentURI property (document, XMLDocument)

Browser support:
Sets or returns the absolute location of the document.
In Internet Explorer, use the location.href property to get a HTML document location.

Syntax:

object.documentURI;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that sets or retrieves the location of the document.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the documentURI property:
<head>
    <script type="text/javascript">
        function Init () {
            var info = document.getElementById ("info");
            if (document.documentURI) {
                info.innerHTML = "The location of the current document:<br />" + document.documentURI;
            }
            else {
                info.innerHTML = "The location of the current document:<br />" + window.location.href;
            }
        }
    </script>
</head>
<body onload="Init ();">
    <div id="info" style="background-color:#e0b0b0;"></div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

User Contributed Comments

Post Content

Post Content