Monday, December 10, 2012

no domain in a string url

This is how to display a string url without its domain name.


var thisUrl="http://domain.com/directory/subdirectory/file.name"
var noDomainUrl = thisUrl.replace(/https?:\/\/[^\/]+/i, "");

alert(noDomainUrl);

No comments:

Post a Comment