Como posso adicionar http://a um URL se ele ainda não inclui um protocolo (por exemplo http://, https://ou ftp://)?
Exemplo:
addhttp("google.com"); // http://google.com
addhttp("www.google.com"); // http://www.google.com
addhttp("google.com"); // http://google.com
addhttp("ftp://google.com"); // ftp://google.com
addhttp("https://google.com"); // https://google.com
addhttp("http://google.com"); // http://google.com
addhttp("rubbish"); // http://rubbish
mozilla.orgsozinho, como saberia se deveria serhttp,httpsouftp?