javascript document URL

URL NN 3 IE 4 DOM 1

 

Read/Write

Provides the URL of the current document. The value is the same as location.href. The document.URL property evolved as a replacement for document.location to avoid potential confusion (by scripters and JavaScript interpreter engines) between the location object and document.location property. To navigate to another page, it is safest (for cross-browser and backward compatibility) to assign a URL string value to the location.href property, rather than this document-centered property.

 
Example
 
document.URL = "http://www.royh.cn";
 
Value

Complete or relative URL as a string.

 
Default

The current document's URL.


  • Guest#20
    #1
    2009-04-09
    [Quote]
    does not work in Firefox
  • javascript manual
    #2
    2009-04-12
    [Quote]
    [Guest#20:does not w...]
    That is not true! It works on Firefox 2 and 3.
  • sascha
    #3
    2010-06-03
    [Quote]
    Hm, in FF 3.6.3 I get the message (in the Firebug console) that this property has only a getter.
  • javascript manual
    #4
    2010-06-03
    [Quote]
    It means read-only.
    Please use location.href='address' to change the URL.
  • t...
    #5
    2011-10-20
    Reviewing ...
Guest#20
javascript manual
sascha
t...

577,Nickname,Homepage or email,Comments here,Add comment