I need to update the following URL validation javascript so that it checks to make sure that the entered url is prefixed with either
http:// or
https://
function isValidURL(url){
var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]
|%[a-fA-f\
d]{2,2})+(
:([\d\w]|%
[a-fA-f\d]
{2,2})+)?@
)?([\d\w][
-\d\w]{0,2
53}[\d\w]\
.)+[\w]{2,
4}(:[\d]+)
?(\/([-+_~
.\d\w]|%[a
-fA-f\d]{2
,2})*)*(\?
(&?([-+_~.
\d\w]|%[a-
fA-f\d]{2,
2})=?)*)?(
#([-+_~.\d
\w]|%[a-fA
-f\d]{2,2}
)*)?$/;
if(RegExp.test(url)){
return true;
}else{
return false;
}
}
Please advise.
Thanks!
- Yvan