I've created a custom URL object in JavaScript and discovered that Firefox already has an object at window.URL
of type MozURL
. I haven't noticed any other browser setting window.URL
, so I'd like to know the following things:
- Are there any unexpected consequences of overriding
window.URL
with my own object - What is
window.URL
used for in Firefox? - Are there any other browsers that also set
window.URL
to their own object1
My back-up plan is of course to use a namespacing object, but I'd rather be able to write new URL()
instead of new foo.URL()
.
[1] this is, of course, subject to change with later versions of browsers so remember to note the dates on any answers
edit to add:
I just had the thought of naming the object URI
instead of URL
, but even so I'll probably stick to namespacing to avoid possible future conflicts with URI
.