Anti Adblock Script for blogger [ 2026 ]
How to Add Adblock detection script [ 2026 ]
Anti Adblock Script for blogger, Detecting an Ad-Blocker Using JavaScript,Adblock detection script,Blog

<!-- CSS (Place before </head>) -->
<style>
/* Ads blocker by bongseiha 20224 - Updated */
.hidden { display: none !important; }
.center { height: 100%; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; }
.ADs-BG { background: rgba(255, 255, 255, 0.58); width: 100vw; height: 100vh; position: fixed; z-index: 99999; top: 0; left: 0; backdrop-filter: blur(3px); }
.at-adblock-content-wrapper { box-shadow: 24px 24px 48px rgba(0, 0, 0, 0.4); border-radius: 10px; max-width: 400px; background: #fff; height: auto; width: 100%; animation: fadeIn 0.3s ease-in-out; }
.at-adblock-content { padding: 30px 50px; }
.at-adblock-text, .at-adblock-text h3 { text-align: center; font-family: inherit; font-weight: 700; }
.at-adblock-text h3 { font-size: 25px; margin-top: 1rem; color: #333; }
.at-adblock-text p { margin: 20px auto; font-weight: 500; font-size: 14px; color: #555; }
.at-adblock-button .ad-btn { line-height: 1em; border-radius: 30px; border: 2px solid #b23939; padding: 12px 20px; width: 100%; background: #b23939; color: #fff; transition: 0.2s; cursor: pointer; font-weight: bold; }
.at-adblock-button .ad-btn:hover { background: #fff; color: #b23939; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 480px){ .at-adblock-content-wrapper { max-width: 90%; } .at-adblock-text h3 { font-size: 20px; } .at-adblock-text p { font-size: 13px; } }
</style>
<!-- HTML (Place just inside <body>) -->
<div class='ADs-BG center hidden' id='ST1mar'>
<div class='at-adblock-content-wrapper'>
<div class='at-adblock-content'>
<div class='center'>
<div class='logo'>
<svg style='width:58px;height:58px' viewBox='0 0 24 24'>
<path d='M8.27,3L3,8.27V15.73L8.27,21H15.73C17.5,19.24 21,15.73 21,15.73V8.27L15.73,3M9.1,5H14.9L19,9.1V14.9L14.9,19H9.1L5,14.9V9.1M11,15H13V17H11V15M11,7H13V13H11V7' fill='#b23939'/>
</svg>
</div>
</div>
<div class='at-adblock-text'>
<h3>Attention! Ad blocker Detected!</h3>
<p>We know ads are annoying, but please bear with us here & disable your ad blocker to support the site!</p>
</div>
<div class='at-adblock-button'>
<button class='ad-btn' id='reload-btn'>Okay, I disabled it</button>
</div>
</div>
</div>
</div>
<!-- JS (Place just before </body>) -->
<script>
document.addEventListener("DOMContentLoaded", function() {
function checkAdBlocker() {
// Attempt to fetch a common ad script URL
const request = new Request(
"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",
{ method: "HEAD", mode: "no-cors" }
);
fetch(request)
.then(response => {
// If fetch succeeds, no ad blocker is active on this URL
console.log("Ads are allowed.");
})
.catch(error => {
// If fetch fails, it was blocked by a network filter (Adblocker)
const adModal = document.getElementById("ST1mar");
if (adModal) {
adModal.classList.remove("hidden");
}
});
}
// Run the check after a tiny delay to ensure extensions have loaded
setTimeout(checkAdBlocker, 500);
// Handle the "Okay" button click
const reloadBtn = document.getElementById("reload-btn");
if (reloadBtn) {
reloadBtn.addEventListener("click", function() {
location.reload();
});
}
});
</script>