The code presented in this page can be used to detect if the visitor has an Ad-Blocker that blocks Ads, and to display a friendly message to visitor when the JavaScript is disabled or Ads are blocked.
The script was tested with Adblock Plus.

- Just add the following HTML /CSS /JS code in the pages of your website.
<div id='jsad_notify'>
Parts of this site works with JavaScript enabled; and without AdBlock.<br>
Please consider supporting us by disabling your Ad-Blocker on this website.

border:2px solid #0000be;

// <![CDATA[
//if JavaScript enabled, it hides #jsad_notify
var jsad_notify = document.querySelector('#jsad_notify'); ='none';

//adds a child-element in page which usually is blocked by Ad-Blocker
var test_adb = document.createElement('div');
test_adb.innerHTML ='&nbsp;';
test_adb.className ='adsbox';
 //if Ads blocked it shows the message, else it removes the #jsad_notify
 if(test_adb.offsetHeight ===0) ='block';
 else jsad_notify.outerHTML ='';

 document.body.removeChild(test_adb); //removes test_adb elm.
}, 700);
// ]]>
- To change the position and design of the message, edit the CSS properties of the #jsad_notify element.

Daily Test with Code Example

Which HTML5 tag defines marked text? (can be used to highlight parts of text)
<mark> <embed> <span>
<p>Free corses: <mark></mark> for Web Development.</p>
Which CSS pseudo-class adds a style to an element when the mouse is over it?
:focus :hover :active
a:hover {
  font-weight: bold;
  color: #00da01;
Click on the function which returns a string value that represents the number rounded to the x digits after the decimal point.
toPrecision(x) toFixed(x) floor(x)
var num = 12.34567;
num = num.toFixed(2);
alert(num);       // 12.35
Indicate the PHP function which reads an entire file into an array.
[) file() readfile()
$arr = file("a_file.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
Show a message if JavaScript disabled or Ad-Blocker

Last accessed pages

  1. Get Duration of Audio /Video file before Upload (5913)
  2. Follow the mouse cursor with a DIV inside a Parent (2703)
  3. Register and show online users and visitors (23278)
  4. Node.js Move and Copy Directory (1127)
  5. SHA1 Encrypt data in JavaScript (8256)

Popular pages this month

  1. Read Excel file data in PHP - PhpExcelReader (390)
  2. PhpSpreadsheet - Read, Write Excel and LibreOffice Calc files (332)
  3. Register and show online users and visitors (302)
  4. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (234)
  5. Insert, Select and Update NULL value in MySQL (223)