Original issue: #264
First, if I understand correctly, currently if there is onerror event then noopFunc is returned:
|
return Reflect.apply(target, thisArg, [eventName, noopFunc]); |
What in case if there will be onload event?
Something like:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" onerror="showPopup();" onload="loadContent()"></script>
<script>
function showPopup() {
alert('adblock');
}
function loadContent() {
alert('content loaded');
}
</script>
Test website - https://jsfiddle.net/sL62htaz/
Will be onload executed or not?
If not, maybe it will be a good idea to check if onload is a function and then return it.
Second - at the moment we can prevent script, img and iframe, but lately I noticed that one of the websites is using link.
Something like:
<script>
(() => {
const createScript = document.createElement("link");
createScript.href = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
createScript.rel = "preload";
createScript.as = "script";
createScript.onload = () => {
let video = '<iframe width="560" height="315" src="https://www.youtube.com/embed/Fy2rtb95QhY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
let createDiv = document.createElement("div");
document.body.appendChild(createDiv);
createDiv.innerHTML = video;
};
createScript.onerror = () => {
alert("adblock");
};
document.body.appendChild(createScript);
})();
</script>
Test page - https://jsfiddle.net/e2un8pav/
Maybe we could also add link to possible values.
Original issue: #264
onerror(if I'm not wrong, it doesn't work correctly)onloadfunctionlinkFirst, if I understand correctly, currently if there is
onerrorevent thennoopFuncis returned:Scriptlets/src/scriptlets/prevent-element-src-loading.js
Line 177 in 202f6d8
What in case if there will be
onloadevent?Something like:
Test website - https://jsfiddle.net/sL62htaz/
Will be
onloadexecuted or not?If not, maybe it will be a good idea to check if
onloadis a function and then return it.Second - at the moment we can prevent
script,imgandiframe, but lately I noticed that one of the websites is usinglink.Something like:
Test page - https://jsfiddle.net/e2un8pav/
Maybe we could also add
linkto possible values.