Hidden image after redirect by check filename


$("img.class").load(function() {
var noImage = this.src;
var xhr;
var _orgAjax = jQuery.ajaxSettings.xhr;
jQuery.ajaxSettings.xhr = function () {
xhr = _orgAjax();
return xhr;
};
$.ajax({
type: "GET",
url: noImage,
success: function(data) {
console.log(xhr.responseURL);
if (xhr.responseURL == 'https://www.domain.com/folder/noimage.jpg') {
$(".class").hide();
}
}
});
});
*/
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://www.domain.com/folder/theimage.jpg', true);
xhr.onload = function () {
console.log(xhr.responseURL);
//if (xhr.responseURL == 'https://www.domain.com/folder/noimage.jpg') {
var noimage = new RegExp("noimage");
if (noimage.test(xhr.responseURL)) {
$(".class").hide();
}
};
xhr.send(null);



Article ID: 44
Created On: Wed, Sep 30, 2020 at 7:13 AM
Last Updated On: Mon, Oct 26, 2020 at 6:00 AM
Authored by: Saeed Nobakht [[email protected]]

Online URL: https://www.navel.ir/article/hidden-image-after-redirect-by-check-filename-44.html