4 ms·
Each of those cases is far more difficult than you imply, because the browser has to try to distinguish legitimate usage of APIs from the usage you want to bloc
by roca 8y ago
Each of those cases is far more difficult than you imply, because the browser has to try to distinguish legitimate usage of APIs from the usage you want to block.
For example there is no "display an ad" DOM API or HTML element. There are simply APIs that put text and images on the page, and you're asking the browser to figure out which are ads and block them.
There is a window.open API that can open a new window, and it has legitimate uses that you don't want to block (e.g. pop out Gmail reply to its own window).
Even "playing a video" is tricky because Web pages can play video without using the <video> element, e.g. just flipping through a list of static images, which is not blockable in practice.
So in practice the browser does have to do a lot of work to filter out unwanted behaviors.