[thelist] Extracting Path/Filename from URL

Peter Hammar phammar at dplanet.ch
Sat Dec 23 11:36:21 CST 2000


Hi,
this script will put the path after the server name in an array:

theLoc=window.location+""
thePath=theLoc.split("http://")[1].split("/")
for(i=1;i<thePath.length-1;i++){
 document.write(thePath[i]+"<br>")
}
theFile=thePath[thePath.length-1]
document.write(theFile)

HTH.
Peter

> Does anyone know the best way to extract the path/filename from either the
> window.location or document.location properties?  I want to delete the
> http://server info (if it exists in the property).  Any help would be
> great!






More information about the thelist mailing list