PDA

View Full Version : anything like Request.ServerVariables("URL") in js


avivit
09-12-2004, 08:45 AM
Hi,

Is there a way to find the url of a page, in html page,
and not in asp page?
Anything like Request.ServerVariables("URL") in jscript???

Thanks

A1ien51
09-12-2004, 03:23 PM
document.location.href;

????????

avivit
09-13-2004, 06:47 AM
Thanks.
Actually I thought of something similar to Request.ServerVariables("URL") in asp, which brings the part of url that's under the root, and not the full url.
I understand there is nothing built in in js, but needs to use array and split on document.location.href.

Thanks very much.

glenngv
09-13-2004, 07:14 AM
Maybe what you want is location.pathname

A1ien51
09-13-2004, 01:25 PM
There are other methods that you may be looking for:
http://www.javascriptkit.com/jsref/location.shtml

Eric