Skip to content

Commit dcca3b9

Browse files
committed
检验URL链接是否有效
1 parent 64b7339 commit dcca3b9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

getUrlState.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @description 检验URL链接是否有效
3+
* @author 未知
4+
*/
5+
6+
function getUrlState(URL){
7+
var xmlhttp = new ActiveXObject("microsoft.xmlhttp");
8+
xmlhttp.Open("GET",URL, false);
9+
try{
10+
xmlhttp.Send();
11+
}catch(e){
12+
}finally{
13+
var result = xmlhttp.responseText;
14+
if(result){
15+
if(xmlhttp.Status==200){
16+
return(true);
17+
}else{
18+
return(false);
19+
}
20+
}else{
21+
return(false);
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)