tags:

views:

62

answers:

2

Hi all! 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 get the web address?

Can someone please help me out with this.

Thanks!

+2  A: 

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

Webbisshh
no @webbish! document.location.href or window.location.href gives me the following :chrome://browser/content/browser.xulthis is the chrome url. What i need is the external Http URL! any suggestions on wer i mite be going wrong?
encryptor
I tried this... I am getting the proper URL.
Webbisshh
A: 

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

javascript:(alert(document.URL))

Michael