Created
May 12, 2020 12:56
-
-
Save devded/af2fad2b2e383e937c61c9b791d6c24c to your computer and use it in GitHub Desktop.
FTP website didn't support all ISP network. This Script help to find the website support on network or not sending a fetch request.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function check(url){ | |
let cors = "https://cors-anywhere.herokuapp.com/"; //This API enables cross-origin requests to anywhere. | |
let checkUrl= cors+url; //Merge cors and checking website url to avoid the cross-origin requests error | |
let response = await fetch(checkUrl); //JavaScript can send network requests to the server | |
if (response.ok) { | |
alert("Website Support On Your Network"); // if HTTP-status is 200-299 | |
} else { | |
alert("Website Not Support On Your Network"); | |
} | |
} | |
check("https://www.youtube.com/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment