How to add http:// if it's not exists in the URL?
        Posted  
        
            by David
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by David
        
        
        
        Published on 2010-05-04T00:22:54Z
        Indexed on 
            2010/05/04
            0:28 UTC
        
        
        Read the original article
        Hit count: 836
        
Hi,
How to add http:// to the url if there isn't a http:// or https:// or ftp:// ?
Example:
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
© Stack Overflow or respective owner