Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
February 18, 2025 - @955.31 (what is this?)
Activity rating: Four Stars Posts & Arts: 80/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :skull: Websites are like whispers in the night  :skull: Super News: E-Zine #3 Accepting Entries!

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  HELP: AdBlock detector


« previous next »
Pages: [1] Print
Author Topic: HELP: AdBlock detector  (Read 725 times)
JoacoEra
Newbie
*


⛺︎ My Room

View Profile WWW

First 1000 Members!Joined 2023!
« on: February 23, 2023 @866.56 »

Im looking for an easy script that detects most AdBlocks extension  :ok:
I want to make a joke in mi site for those who are using one hehe
« Last Edit: February 23, 2023 @868.03 by JoacoEra » Logged

:transport: ⌈Just a Burning Memory⌋ :TnT:
Melooon
Hero Member ⚓︎
*****


So many stars!

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Thanks for being rad!a puppy for your travelsAlways My PalFirst 1000 Members!spring 2023!
« Reply #1 on: February 23, 2023 @871.93 »

I have not tested this myself, but generally ad blockers try to block any elements on the page that are called "ad", its a lot more simple than you'd expect! So all you need to do is put a div on the page called like "ad" and then check to see if its been deleted or not - I found this script!

Code
// Create a fake ad element
var fakeAd = document.createElement('div');
fakeAd.innerHTML = ' ';
fakeAd.className = 'adsbox';
document.body.appendChild(fakeAd);

// Check if the element is hidden
function detectAdblock() {
  if (fakeAd.offsetHeight === 0) {
    // Adblock detected
    alert('Please disable your adblocker!');
  } else {
    // No adblock detected
    alert('Thank you for not using an adblocker!');
  }
}

// Run the function after page load
window.addEventListener('load', detectAdblock);

You could also do it without a script; make a div this has an inner div covering it with class="ad" then if the ad is blocked you'll see whats underneath it ^^  :grin:
Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

AI-Content Detector While Browsing?

Started by YayaBoard ☞ ∙ Life on the Web

Replies: 12
Views: 1083
Last post April 10, 2024 @344.70
by Memory
What helped you code html/css easy?

Started by LIABoard ✁ ∙ Web Crafting

Replies: 17
Views: 2420
Last post October 11, 2023 @152.56
by flowers
Melons critiquing and helping each other

Started by urgellxBoard ✎ ∙ Art Crafting

Replies: 22
Views: 2266
Last post August 24, 2024 @487.13
by e-

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi