How to remove ‘http://’ from a URL in JavaScript [duplicate] February 9, 2023 by Tarik I think it would be better to take into account all possible protocols. result = url.replace(/(^\w+:|^)\/\//, '');