Как добавить http:// к URL-адресу, если он еще не включает протокол (например, http://, https:// или ftp:/) /)?
Пример:
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
Подробнее здесь: https://stackoverflow.com/questions/276 ... in-the-url