JSFiddle - React, Tailwind, and code Playground
JavaScript
url="ftp://example.com";
protocols = ['http', 'https', 'ftp', 'sftp', 'ssh', 'smtp'];
protocols.forEach(function(item) {
if(url.indexOf(item) != -1) {
newUrl = "http://"+url.substr(url.indexOf("//")+2);
}
});
alert(newUrl);