javascript 里有个URL方法,可以通过它判断。但是它的功能还可以将URL解析出来,host,pathname, 参数等等
function isUrl(string){
try {
new URL(string);
return true;
} catch (err) {
return false;
}
}
javascript 里有个URL方法,可以通过它判断。但是它的功能还可以将URL解析出来,host,pathname, 参数等等
function isUrl(string){
try {
new URL(string);
return true;
} catch (err) {
return false;
}
}