Come posso aggiungere http://
un URL se non include già un protocollo (ad es http://
. https://
O ftp://
)?
Esempio:
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.org
da solo, come sapresti se dovrebbe esserehttp
,https
oftp
?