1suppose that you have a page with this address: http://sub.domain.com/virtualPath/page.htm. use the following in page code to achive those results:
2
3window.location.host : you'll get sub.domain.com:8080 or sub.domain.com:80
4window.location.hostname : you'll get sub.domain.com
5window.location.protocol : you'll get http:
6window.location.port : you'll get 8080 or 80
7window.location.pathname : you'll get /virtualPath
8window.location.origin : you'll get http://sub.domain.com *****