Currently I have a form in which you must enter a valid URL, although I don't have a way of validating that it ends in a extension such as .com or .co.uk etc..
Here's my current function which makes sure it's a http://
function addhttp(url) {
if (!/^(f|ht)tps?:\/\//i.test(url)) {
url = "http://" + url;
}
return url;
}
I can't find a way to verify the end of the url
variable to make sure its a .com
etc...