Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
June 06, 2026 - @411.01 (what is this?)
Activity rating: Four Stars Posts & Arts: 76/1k.beats Random | Recent Posts | Guild Recents
News: Love is not possession  :4u: Guild Events: Happy Pride Month Fibre Artists!

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  HELP: AdBlock detector


« previous next »
Pages: [1] Print Embed
Author Topic: HELP: AdBlock detector  (Read 1475 times)
JoacoEra
Newbie
*
View Profile WWW


⛺︎ My Room

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

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 ⚓︎
*****
View Profile WWWArt


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

Guild Memberships:
Artifacts:
Flinstone VitaminAlways working hard!Known Apple shillcoolest melon on the web!Emergency feel-good teaa silly heart 4 melon :)
« Reply #1 on: February 23, 2023 @871.93 » Embed

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

Artifact Swap: Wildflowers!seahorseyHungry Mousebitsy catSquidwardRed TulipMellohiHelp, my tail is stuck!InternetPoochcyberziI seek you!I met Dan Q on Melonland!?Stinky CheeseFlowersOpalRaw beefEvil fucking snailPlank
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ 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
MelonLand @000

Want to Login or Join ?

Minecraft: Online
Join: craft.melonking.net