Skip to content

Instantly share code, notes, and snippets.

@brandonhill
Created June 23, 2022 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonhill/0a86dea294ab445570e35815b390f544 to your computer and use it in GitHub Desktop.
Save brandonhill/0a86dea294ab445570e35815b390f544 to your computer and use it in GitHub Desktop.
Ad blocker detection
// makes dummy ad call, if errored assumes blocker present
((d, src) => {
const s = d.createElement('script')
s.addEventListener('error', () => {
console.log('ad blocker present')
// tell them how their content theft makes you feel appreciated...
})
s.async = true
s.src = src
d.head.appendChild(s)
})(document, '//www.npttech.com/advertising.js')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment