I am trying to use jQuery to check if URL is available or not. I am using the below Javascript code to verify this but it works for only HTTP URLs. If the URL is HTTPS it fails and I get the error alert.
var backendUrl = "https://myserver:8081/app/test.jsp";
$.ajax({
type: "GET",
url: backendUrl
}).done(function (result) {
console.log("working");
window.location.href = backendUrl;
}).fail(function () {
alert(Sorry URL is not access able");
});
Can someone tell me a reason and some more precise way to check if URL is available or not using javascript.