Skip to content

Instantly share code, notes, and snippets.

@chrisryana
Last active June 29, 2021 17:13
Show Gist options
  • Save chrisryana/460ba220d68225108c9cea5256aadd9a to your computer and use it in GitHub Desktop.
Save chrisryana/460ba220d68225108c9cea5256aadd9a to your computer and use it in GitHub Desktop.
Функция для проверки включен ли блокировщик рекламы UBlock
const adBlockCheck = () => {
let adBlockEnable = false;
const node = document.createElement('a');
node.innerHTML = '&nbsp';
// для AdBlock: node.classList.add('adsBanner');
node.setAttribute('href', '/open?refer');
node.style.position = 'absolute';
document.body.appendChild(node);
if (!node || node.offsetHeight === 0) {
adBlockEnable = true;
}
document.body.removeChild(node);
return adBlockEnable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment