Due EU privacy laws it’s illegal to spy your device:
„(…) scripts used to detect ad blockers also fall under Article 5.3 of the ePrivacy Directive, a rule that requires websites to ask for user consent before storing or accessing information on a user’s device“ (Source)
To prevent Youtube to use scripts to detect adblockers on your device follow the proof of concept:
- Install uBlock Origin
- Add the following lines to your uBlock Origin Filter:
youtube.com##+js(set, yt.config_.openPopupConfig.supportedPopups.adBlockMessageViewModel, false) youtube.com##+js(set, Object.prototype.adBlocksFound, 0) youtube.com##+js(set, ytplayer.config.args.raw_player_response.adPlacements, []) youtube.com##+js(set, Object.prototype.hasAllowedInstreamAd, true
You can do so by opening uBlock Origin, heading to its settings > My Filters, then click a new line and paste the above in. Hit “Apply changes,” then head to YouTube to see if it works.