Created
February 12, 2021 17:25
-
-
Save 0bach0/f93bc0f2cb597e5bc2b7a6fc43692cd9 to your computer and use it in GitHub Desktop.
For display an alert for remind user to help me run this page
This file contains hidden or 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
// Need jQuery | |
// dataType and crossDomain for ignore CORS | |
// In case of loading adsbygoogle.js success, it still throw error related to the callback. That's why I only catch the 404 error | |
$.ajax({ | |
type: "HEAD", url: "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", | |
dataType: 'jsonp', | |
crossDomain: true, | |
success: function (data, text) { | |
// skip | |
}, | |
error: function (request, status, error) { | |
if(request.status==404) | |
alert("Please disable adblock, it helps me running this blog :)"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment