Skip to content

Commit

Permalink
[lib] when checking for newer URLs, return false if the result is any…
Browse files Browse the repository at this point in the history
…thing besides http.status=200
  • Loading branch information
Emmanuel Schanzer committed Mar 21, 2023
1 parent bf67050 commit e163402
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/bootstraplesson.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*******************************************
* IDENTIFY OLD VERSIONS
*******************************************/
function UrlExists(url) {
function UrlExists(url) {
var http = new XMLHttpRequest();
http.open('HEAD', url, false); // TODO: change this to 'true' and use a promise to render the out of date banner
http.send();
return (http.status !== 404)
console.log('checking for', url, 'status is', http.status)
return (http.status == 200)
}

function isNewest() {
Expand Down Expand Up @@ -34,6 +35,7 @@
}
}


/*******************************************
* ATTACH OPEN/CLOSE EVENTS TO LESSON SIDEBAR
*******************************************/
Expand Down

0 comments on commit e163402

Please sign in to comment.