Share code thông báo chặn quảng cáo (Ad-Blocker Detected)
Hôm qua, có bạn hỏi mình cách chặn người dùng khi sử dụng tiện ích chặn quảng cáo trên blog/website (AdBlock), nay đang rảnh nên mình viết bài share luôn cho mọi người. Chắc cũng nhiều người cần dùng đến nó ^^
|
| Code chặn sử dụng Adblocker Block |
Trước tiên bạn cần tìm hiểu AdBlock là gì. Đây là một add on của trình duyệt để giúp người sử dụng chặn các liên kết tới những trang họ không muốn như những link quảng cáo. Điều này quả thật là không hay với những blogger đang hợp tác quảng cáo với các trang khác bởi các mã quảng cáo trên trang của bạn sẽ bị trình duyệt cài add on đó vô hiệu hóa không thể hiện thị. Điều đó cũng đồng nghĩa với việc bạn sẽ không thể kiếm được một su từ những click quảng cáo đó. Đó cũng là lý do ngày càng có nhiều người tham gia vào các hội untiblock trên các diễn đàn thế giới...
Hướng dẫn chi tiết
- Copy đoạn code phía dưới
- Dán toàn bộ code đã copy phía trên vào trước thẻ đóng </body>
- Lưu lại là xong rồi !
<!--[ Anti Ad-Blocker]-->
<div class='flip-in-x hidden' id='antiAdBlocker'>
<div class='flip-in-x-warning-box'>
<svg class='line' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10'></circle><line x1='12' x2='12' y1='8' y2='12'></line><line x1='12' x2='12.01' y1='16' y2='16'></line></svg>
<h2>Ad-Blocker Detected!</h2>
<p>Sorry, we detected that you have activated Ad-Blocker.<br/>Please consider supporting us by disabling your Ad-Blocker and refresh the page, it helps us in developing this Site.<br/>Thank you for understanding :)</p>
</div>
</div>
<script>/*<![CDATA[*/ /* Anti Ad-Blocker (Lazyload) */ var lazyAnti=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyAnti||0!=document.body.scrollTop&&!1===lazyAnti)&&(!function(){var antiAdBlocker=document.querySelector("#antiAdBlocker");var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";e.onerror=function(){if(antiAdBlocker!=null){antiAdBlocker.classList.remove("hidden");window.lazyAnti=!0}};var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyAnti=!0)},!0); /*]]>*/</script>
<style>
.flip-in-x{position:fixed;top:0;left:0;bottom:0;right:0;background:rgba(255, 255, 255, 0.1);z-index:999;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);display:flex;justify-content:center;align-items:center}
.flip-in-x.hidden{display:none}
.flip-in-x .flip-in-x-warning-box{position:relative;background:rgba(255, 255, 255, 1);max-width:330px;display:flex;text-align:center;justify-content:center;align-items:center;flex-direction:column;margin:6px;padding:20.6px 33.2px;border-radius:33px;box-shadow:0 12px 33px rgb(0 0 0 / 33%);animation:flipInX 1.5s}
.flip-in-x .flip-in-x-warning-box>svg{display:block;width:50px;height:50px;stroke:#FF0000;stroke-width:1.5}
.flip-in-x .flip-in-x-warning-box h2{margin:6px 0 12px 0;font-size:1.2rem;font-weight:800}
.flip-in-x .flip-in-x-warning-box p{margin:0;line-height:1.7em;font-size: 0.9rem}
.drK .flip-in-x{background:rgba(0, 0, 0, 0.3)}
.drK .flip-in-x .flip-in-x-warning-box{background:#252526}
.drK .flip-in-x .flip-in-x-warning-box>svg{stroke:#fefefe}
@keyframes flipInX{from{-webkit-transform:perspective(359px) rotate3d(1,0,0,90deg);transform:perspective(359px) rotate3d(1,0,0,90deg);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(359px) rotate3d(1,0,0,-20deg);transform:perspective(359px) rotate3d(1,0,0,-20deg);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}60%{-webkit-transform:perspective(359px) rotate3d(1,0,0,10deg);transform:perspective(359px) rotate3d(1,0,0,10deg);opacity:1}80%{-webkit-transform:perspective(359px) rotate3d(1,0,0,-5deg);transform:perspective(359px) rotate3d(1,0,0,-5deg)}to{-webkit-transform:perspective(359px);transform:perspective(359px)}}
</style>Lời kết
Trên đây là code thông báo và chặn AdBlock. Nếu có bất cứ thắc mắc hay khiếu nại về bản quyền hãy comment ngay phía dưới cho mình biết nhé. Chúc các bạn một ngày học tập và làm việc thật hiệu quả !!!
Truy cập Bypass Google Account APK để tải file APK nhé