please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Document.URL Property

Name

Document.URL Property---the URL of the current document

Availability

Navigator 2.0; enhanced in Navigator 3.0

Synopsis

document.URL

Description

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.

Usage

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>

See Also

"Document", "Document.lastModified", "Document.location", "Document.referrer", "Document.title", "Location", "Window.location"


Previous Home Next
Document.title Book Index Document.vlinkColor

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_93.htm, 5KB, , updated: 2019/10/14 15:00, local time: 2024/11/8 14:00,
TOP NEW HELP FIND: 
3.145.180.101:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/Techref/language/java/script/definitive/refp_93.htm"> [Chapter 21] Reference: Document.URL</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?