Navigator 2.0; enhanced in Navigator 3.0
document.URL
URL is a read-only string property that contains the complete URL of the current document.
document.URL is usually equal to window.location.href for the window that contains document. These two are not always equal, however, because the Document.URL property may be modified through URL redirection--Window.location contains the requested URL, and Document.URL specifies the actual URL where it was found.
The Document.location property is a synonym for the Document.URL property. The URL property is the preferred one, because it is less likely to be confused with the Window object's location property. Note, however, that in Navigator 2.0, the URL property does not appear in for/in loops run over Document objects. Also, the URL property is not supported by Internet Explorer 3.0.
Some web authors like to include the URL of a document somewhere within the document, so that, for example, if the document is cut-and-pasted to a file, or printed out, there will still be a reference to where it can be found online. The following script, when appended to a document will automatically add the document's URL. (Unfortunately, in Netscape 2.0, text such as this generated by JavaScript won't appear in printouts, which defeats an important purpose of including the location in the first place.)
<script> document.write('<P><HR><SMALL><I>URL: ' + document.URL + '</I></SMALL>'); </script>
"Document", "Document.lastModified", "Document.location", "Document.referrer", "Document.title", "Location", "Window.location"
file: /Techref/language/java/script/definitive/refp_93.htm, 5KB, , updated: 2019/10/14 15:00, local time: 2024/11/22 11:37,
18.226.17.210:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/language/java/script/definitive/refp_93.htm"> [Chapter 21] Reference: Document.URL</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.