Ok lets say I have a URL
example.com/hello/world/20111020 (with or without the trailing slash). What I would like to do is strip from the url the domain example.com.
For parsing URLs, one different approach can be using anchor DOM object.
var a = document.createElement("A");
a.href = 'http://example.com:8080/path/to/resources?param1=val1¶ms2=val2#named-anchor';
a.protocol; // http:
a.host; // example.com:8080
a.hostname; //example.com
a.port; // 8080 (in case of port 80 empty string returns)
a.pathname; // /path/to/resources
a.hash; // #named-anchor
a.search // ?param1=val1¶ms2=val2