Ray's Test Pages - Using JS to parse the URL

This is the entire URL given by location.href...

The host property is a string comprising of the hostname and port strings. This is the string given by location.host...

The hostname property specifies the server name, subdomain and domain name (or IP address) of a URL. This is the string given by location.hostname...

The pathname property is a string portion of a URL specifying how a particular resource can be accessed. This is the string given by location.pathname...

The port property is a string specifying the communications port that the server uses. This is the string given by location.port...

The protocol property is the string at the beginning of a URL, up to and including the first colon (:), which specifies the method of access to the URL, e.g. "http:", "mailto:", "ftp:", etc. This is the string given by location.protocol...

The title property is the string given in the TITLE tag. This is the string given by document.title...

Sources:-

http://www.eggheadcafe.com/articles/20020107.asp

http://www.regular-expressions.info/javascript.html

This page created 2nd July 2005, last modified 2nd July 2005


GoStats stats counter