A
alu
Could someone explain the discrepancies within and between the stated
definitions / usage of 'document.location' , 'document.URL' vs. their actual
functionality?
Should they be read-only when in fact they are not?
Is 'document.URL' also deprecated, and should therefore never be used?
What is the last word re: the proper syntax for returning and setting the
current window's location?
We have:
document.location
document.location.href
document.URL
window.location
window.location.href
location
location.href
The documentation:
-------------------------------
http://www.faqts.com/knowledge_base/view.phtml/aid/6702
"document.location is deprecated and should never be used.
Instead, either use document.URL or window.location.href."
http://webreference.com/programming/javascript/jf/column10/
"Location is not a property of the document object; its equivalent is the
document.URL property. The document.location property, which is a synonym
for document.URL, is deprecated. Instead, the 'location.href' or
'window.location.href' property should be used."
http://www.mozilla.org/docs/dom/domref/dom_doc_ref26.html#1025116
"document.location works the same as document.URL. Both are read-only
properties unlike window.location, which can be set."
"URL is a replacement for the DOM Level 0 document.location.href property.
However document.URL is not settable, unlike document.location.href."
Actual test results:
------------------------------
IE/Win local:
document.location: file:///T:/frameset/mainframe.html?test (settable)
document.URL: file://T:\frameset\mainframe.html (settable -
note lack of query string and backslashes)
------------------------------
IE/Win live:
document.location: http://home.prims.com/x/mainframe.html?test
(settable)
document.URL: http://home.prims.com/x/mainframe.html?test
(settable - note query string appears)
------------------------------
FF/Win local:
document.location: file:///T:/frameset/mainframe.html?test
(settable)
document.URL: file:///T:/frameset/mainframe.html?test
(read-only)
FF/Win live:
-----------------------------
document.location: http://home.prims.com/x/mainframe.html?test
(settable)
document.URL: http://home.prims.com/x/mainframe.html?test
(read-only)
definitions / usage of 'document.location' , 'document.URL' vs. their actual
functionality?
Should they be read-only when in fact they are not?
Is 'document.URL' also deprecated, and should therefore never be used?
What is the last word re: the proper syntax for returning and setting the
current window's location?
We have:
document.location
document.location.href
document.URL
window.location
window.location.href
location
location.href
The documentation:
-------------------------------
http://www.faqts.com/knowledge_base/view.phtml/aid/6702
"document.location is deprecated and should never be used.
Instead, either use document.URL or window.location.href."
http://webreference.com/programming/javascript/jf/column10/
"Location is not a property of the document object; its equivalent is the
document.URL property. The document.location property, which is a synonym
for document.URL, is deprecated. Instead, the 'location.href' or
'window.location.href' property should be used."
http://www.mozilla.org/docs/dom/domref/dom_doc_ref26.html#1025116
"document.location works the same as document.URL. Both are read-only
properties unlike window.location, which can be set."
"URL is a replacement for the DOM Level 0 document.location.href property.
However document.URL is not settable, unlike document.location.href."
Actual test results:
------------------------------
IE/Win local:
document.location: file:///T:/frameset/mainframe.html?test (settable)
document.URL: file://T:\frameset\mainframe.html (settable -
note lack of query string and backslashes)
------------------------------
IE/Win live:
document.location: http://home.prims.com/x/mainframe.html?test
(settable)
document.URL: http://home.prims.com/x/mainframe.html?test
(settable - note query string appears)
------------------------------
FF/Win local:
document.location: file:///T:/frameset/mainframe.html?test
(settable)
document.URL: file:///T:/frameset/mainframe.html?test
(read-only)
FF/Win live:
-----------------------------
document.location: http://home.prims.com/x/mainframe.html?test
(settable)
document.URL: http://home.prims.com/x/mainframe.html?test
(read-only)