1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Display a replacement banner/bg, ONLY when a visiting user is using an Ad Blocker?

Discussion in 'HTML & JavaScript' started by truelux, Jul 22, 2013.

  1. truelux

    truelux Regular Member

    Joined:
    Jun 16, 2011
    Messages:
    298
    Likes Received:
    91
    I'm not 100% sure how browser plugins, such as Ad Blocker, works but is there a way to still display some type of a picture/css?

    Does an ad block make an entire DIV display:none?

    I'm trying to think of a way to make a banner that says, "This site relies on ads. Please disable your adblocker or click here to donate to have ads removed"

    thanks!
     
  2. CodingAndStuff

    CodingAndStuff Regular Member

    Joined:
    May 6, 2012
    Messages:
    236
    Likes Received:
    84
    Occupation:
    Swagstronaut
    Location:
    You can't have my bots. Sorry :'(
    Typically they remove the element from the DOM entirely (especially in the case of iframed ads) and often get removed if they're standard dimensions (728x90 etc).


    You can just use CSS and apply a background-image rule to the element in question that says what you'd like it to say if the image just doesn't load OR you could check to see if the element exists within the DOM and overwrite whatever attributes you need edited.