Is it possible to prevent a specific function in a specific script from executing inside a browser, with a predefined rule? Like using an adblocker extension or userscript.
website.com utilizes client-side rendering heavily. When
https://website.com/article.html is visited, the bundled big JS file
https://website.com/entire-app.js will render the entire webpage, both contents and ads.
In the end, a function named
https://website.com/entire-app.js will be called by
antiAdBlockerMethod() in the same script file. It checks if ads on the page are indeed loaded and performs other adblocker detection procedures. If this function returns
antiAdBlockerMethod() will then trash and replace all the rendered elements in the DOM with some big warning text.
In this situation, the script
https://website.com/entire-app.js handles all the client-side page rendering, both ads and contents, so simply blocking it from loading will render the website unaccessible.
The idea I can come up with to prevent the page to be cleared up when an adblocker is found is to somehow replace the
isAdblockerFound() function with a function which always returns
false, before it is called. However, I have no idea how to do this with uBlock Origin in Chrome. How can I achieve this and what tools should be needed? Or is there a better alternative method?
EDIT: I understand that I can disable my adblocker anytime and that would be a trivial solution for this question. I also understand why ads exist on the web in the first place, and appreciate the valuable contents made possible by ads. Actually I have never had motive to apply this to any websites I visit, and I am not aware of any websites employing adblocker checking procedures exactly like
website.com in my example. I asked this question because I was simply curious if it is possible to bypass this kind of checking.
I suppose, in a different context, one website could be malicious and a security engineer would need to perform an analysis. He might find fooling an environment checking procedure useful in that scenario.