orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js

Home Page:https://playground.cookieconsent.orestbida.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feat]: Browser cookie popup blocker addon - how to bypass?

bennetsadyba opened this issue · comments

Description

I'm using a cookie blocking browser addon that's supposed to block annoying cookie popups. It does the job fine. The way it works is that the cookie popup never gets displayed to the user. In that case the user has no opportunity to click ACCEPT button and the website and the analytic / marketing tags never fire.

This is a problem. Do you know how to prevent such addon behavior? How does such addon work / detect cookie popups?

Proposed solution

Detect addon

Additional details

No response

These extensions typically hide cookie banners by injecting high priority, inline css, something like this:

#cc-main {
    display: none!Important;
} 

or by blocking the stylesheet/script itself.

You could fix this temporarily, by rebuilding the plugin with a different id, but someone would eventually add that too to the blocking list. You could also try adding an even higher level inline css rule:

html > body > #cc-main,
html > body > #cc-main .cm,
html > body > #cc-main .pm {
    display: block!important;
}

The rules above are just an example. You would need to check out the extension's rules and somehow counter them.

There is no proper/permanent fix for this since extensions have full control of the page. Even if you were to design the plugin with dynamic classes/ids that change on each page load, it could still be blocked; the extension could analyze the structure of the html markup itself, determine what part of the markup represents the cookie banner, and then hide it. It doesn't matter what solution you will adopt, the extension can beat that.

If I were you, I wouldn't even bother trying this; if someone is using a banner blocker, your analytics/ads scripts are probably being blocked too, via an ad blocker.

You are right, thank you for explanation :)