21157

How to make an ad wrapper which displays a message if a user has adblock running?

Question:

I have a website with an ad on every page.

I'd like to display a message saying, "Please consider disabling your adblock, it helps us out tremendously." if the user has AdBlock enabled.

Here's my attempt:

<div id="ad-wrapper"> <!-- Ad script here. It works fine. --> </div>

And my CSS:

#ad-wrapper { background-color: #1D1D1D; border: 1px solid #232323; float: right; height: 90px; margin-right: 4px; width: 728px; overflow:hidden; background-image: url('/Public/images/disabled-ad.jpg'); }

When I turn off AdBlock the ad is displayed correctly without issues.

When I turn it on, AdBlock completely makes the #ad-wrapper invisible. I thought it would only remove the ad, leaving my background-image message there for my users to see.

How can I accomplish this behavior?

Answer1:

I assume Ad Block is blocking your wrapper because it contains the word "ad". Try using something like:

<div id="disabled-wrapper"> <!-- Ad script here. It works fine. --> </div>

Recommend

  • Centering inside a element
  • How to add css to a JavaFx element
  • jqPlot Styling - How to remove Y axis line?
  • 2-table interaction: insert, get result, insert
  • reduce/reduce conflicts using ocamlyacc
  • Multiple versions of iTunesArtwork in one project?
  • Table striping rows in CSS Grid
  • ZipList with Scalaz
  • Flex items with same property values are rendering in different sizes
  • cell spacing in div table
  • Outlines on links in IE9 remains when focus is changed
  • abstracting over a collection
  • Bash if statement with multiple conditions
  • Copy to all folders batch file?
  • Adjust width of select element according to selected option's width
  • Custom validator control occupying space even though display set to dynamic
  • Change multiple background-images with jQuery
  • FileReader+canvas image loading problem
  • DomPDF {PAGE_NUM} not on first page
  • Insert into database using onclick function
  • Deselecting radio buttons while keeping the View Model in synch
  • Javascript simulate pressing enter in input box
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • ILMerge & Keep Assembly Name
  • Change an a tag attribute in JavaScript based on screen width
  • Importing jscolor library in angular 2
  • Large data - storage and query
  • jquery mobile loadPage not working
  • WOWZA + RTMP + HTML5 Playback?
  • A cron job substitute?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How to stop GridView from loading again when I press back button?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?