RobG wrote on 13 jan 2007 in comp.lang.javascript
:
eureka wrote:
>I need to store the address-bar content of a web page into a string
variable ,
Is there any way I can achieve this through JavaScript?
var s = window.location.href;
alert( s );
Right,
only the address bar is not part of a web page,
it is not necessarily the same as the web page's URL
that is returned by the above js code,
so you can type into the addressbar, whatever you like,
untill you hit return, that is.
Some browsers could perhaps not even have an address bar,
and still be able to execute js.
However, for the suspected purpose of the OP, the answer is right.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)