[Project_owners] Re: URL of current document

Neil Deakin enndeakin at sympatico.ca
Fri Aug 26 14:49:00 EDT 2005


Michael Vincent wrote:

> Neil Deakin wrote:
>
>> Michael Vincent wrote:
>>
>>> Philip Chee wrote:
>>>
>>>> Hi
>>>>
>>>> What's the recommended way from chrome of getting the URL of the 
>>>> current
>>>> document being displayed in a window?
>>>>
>>>> document.location.href
>>>> window.document.location
>>>> window.location.href
>>>> document.url
>>>
>>>
>>>
>>> I would say: getBrowser().mCurrentBrowser.currentURI.spec
>>
>>
>> That is more like the absolute worst way to do it, actually.
>>
>> content.location is more correct.
>
>
> Yes, that is cleaner, but it should not be used if your extension 
> supports older Mozilla builds because of (the now fixed) security 
> issues, right?


The location property can't be overriden by scripts so it doesn't have 
the security issue that other properties have, unless you're referring 
to something else.

/ Neil



More information about the Project_owners mailing list