开发者

reading the current url of a tab

I need to read the browsers URL (specefic to the tab) using javascript. I tried the

var currentURL = window.location; 
alert(currentURL.href) ; 

It shows chrome://browser/content/browser.xul instead of the web address. What should I do to ge开发者_StackOverflowt the web address?

Can someone please help me out with this.

Thanks!


document.location.href OR window.location.href must work !!


Probably already got the answer to this, but simply using document.URL will get you the tab's URL.

javascript:(alert(document.URL))

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜