How to remove 'http://' from a URL in JavaScript [duplicate]
I think it would be better to take into account all possible protocols.
result = url.replace(/(^\w+:|^)\/\//, '');
url = url.replace(/^https?:\/\//, '')
l.href.replace(/^http:\/\//, '')
I think the regular expression you need is /(?:http://)(.*)/i
. The first match of this should be it.