开发者

document.URL vs location.href > no results

I am working on a Firefox extension. For this I need the current URL. I tried bot开发者_Go百科h possibilities with the following result:

location.href   >  chrome://browser/content/browser.xul
document.URL    >  undefined

They are called in the event if a menu button is clicked. Why is it not working?


You are accessing Firefox's DOM, not the web page's one.

To get the window element for the current web page, you can use window.content.

So you can get the location via window.content.location.href.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜