w3c compliant substitute for window.location

D

David M. Gauntt

Is there a w3c compliant substitute for window.location?
I don't need the full functionality of the location
object; just the ability of getting the URL (including
the search field).

- David Gauntt
 
M

Michael Winter

Is there a w3c compliant substitute for window.location?
I don't need the full functionality of the location
object; just the ability of getting the URL (including
the search field).

document.URL

allows you to retrieve the absolute address to the document as a simple
string. IE will allow you to assign to it (and some others might, too),
but it's defined as read-only.

Mike
 
M

Martin Honnen

David said:
Is there a w3c compliant substitute for window.location?
I don't need the full functionality of the location
object; just the ability of getting the URL (including
the search field).

Well the window object is not part of the W3C DOM specification, indeed
that has tried to abstract from user agents. As long as you are
scripting HTML document in browsers there is nothing wrong with using
window
window.document
window.location
I don't see that as not being W3C compliant only because the W3C hasn't
had any interest to standardize that stuff.

SVG 1.2 which is more something like web application tries to
standardize a global object, see
http://www.w3.org/TR/SVG12/api.html#GlobalObject
but I don't think that helps in any way when scripting HTML documents.
 
J

Jim Ley

I don't see that as not being W3C compliant only because the W3C hasn't
had any interest to standardize that stuff.

They'll likely be a web-application working group coming along soon,
they may or may not standardise some of the legacy stuff.

Jim.
 
D

David M. Gauntt

It looks like I may as well keep using window.location. I haven't run
into a browser that doesn't use it, and since document.URL is
read-only, it does't help.

Thanks for the replies!

- David Gauntt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top