I just came across https://www.hotslogs.com, who uses javascript to redirect to the adblock page if the ad does not work properly.
Its source code looks like this
function FillMonkeyBrokerHorizontal01() {}
function nb6fda3f1(src) { //function name is randomly generated
if (true) {
var jqueryWindow = $(window);
jqueryWindow.attr("location", "/Info/AdBloc" + "k?Sour" + "ce=" + src);
} else
ga("send", "event", "AdFillMonkeyBroker", "Ad Blocked Acceptably", {
nonInteraction: true
});
}
//other if-conditions calls this function
My first thought is to modify this function to a function that does nothing. I tried the solution in Stop execution of Javascript function (client side) or tweak it and the example on jsbin.com/ogudon/1 worked for me.
However when I tried my solution
// ==UserScript==
// @name hotslogs.com adblock killer killer
// @description hotslogs.com adblock killer killer
// @include https://www.hotslogs.com/*
// @run-at document-start
// @version 1
// @grant none
// ==/UserScript==
checkForBadJavascripts([
[TRUE,
/mb105.gz.js/, alert("intercepted mb105.gz.js");
]
[FALSE,
/AdBloc/, alert("intercepted adbloc function");
]
]);
//checkForBadJavascripts definitions,etc.
It did not work well, the page redirects to adblock page and no alert was triggered. I am not sure if it is due to the before/afterscriptexecute not supported in HTML5 standard or if I missed anything. Any suggestions or alternative solutions?