Javascript/Util1 [Util No.001] URL 존재여부 체크 안녕하세요. 이번에는 Javascript를 이용하여 URL의 존재여부 체크하는 방법을 공유하고자 포스팅합니다. function checkStatus(req, status) { //console.log('responseURL', req.responseURL); if(status == 200) { // URL 존재 } else { // 에러 or 존재하지 않는 URL console.log(status); } } function urlExistCheck(url) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if(this.readyState == 4) checkStatus(this, this.status); } xhr.open(.. 2021. 4. 19. 이전 1 다음