> Unfortunately, I have no way to detect DNS based blocking short of loading an actual ad.Before that point I'd already spotted that limitation, but there might be an easy solution: get a domain added to a common block list used by DNS based blockers. If you get the right content from a resource on a host with that name (or the other test passes, so we test for both forms of blocker) show the message.
Of course there will be false positives if the page goes down or if they're is some other network issue, but no test like this will be perfect.
Anyone want to save me the research to find out the easiest way to get a domain on the lists? I have no objection to sacrificing a few £ per year on a name to use and I've got spare resource to serve the pile of tiny requests that'll go through because people aren't running a blocker.
EDIT: as a secondary note, I wouldn't just flip between “display:none” and “display:block” on one element upon detection result. That might cause visual disturbance in many page layouts as things load. I would leave a block of the same positioning and size properties in the flow in either case, either blank or with a message like “You'll be pleased to know that your ad blocker seems to be working.”, perhaps leaving the space blank (but still in the flow with the same dimensions) initially so an incorrect message isn't displayed if something (scripting being disabled client-side for instance) stops the tests running at all.