Oojmed Blog

The blog for Oojmed. A non-profit software development group.

Opera: Detecting Opera's built-in adblocker

We’re starting a new series of posting, detailing our ‘adventure’ into web fingerprinting. This series will detail how we have discovered how to figure out what browser or adblocker you are using.

This first post will be detailing how to detect Opera’s built-in adblocker. It’s quite easy, as it injects a style tag into the head of webpages. Quite a proprietary, as most of the time it’s blocked request-side nowadays. At least with browser extensions.

What you need to do, is detect how many style elements there are. If there are more than normal (most likely more than 0), loop through each and see if it’s innerText contains common text in Opera’s adblocker.

Proof of concept / example code:

var styles = document.getElementsByTagName('style');

var injection = styles.length > 0;

if (injection) {
  styles = [].slice.call(styles);

  for (var i = 0; i < styles.length; i++) {
    var styleIsOperaAB = styles[i].innerText.includes(':root topadblock');

    if (styleIsOperaAB) { alert('Opera (Adblock) Detected'); break; }

Proof of Concept