How to disable specific java script

editoi August 2018   Kehitys Chrome

Some site (html) contains the following code:

<script>
    document.addEventListener('DOMContentLoaded', function(){
        $('.answer-text > div:first').attr('class', 'defdecefcfeda');
        try {
            var script = document.createElement('script');
            script.src = '###LINK TO SOME *.JS SCRIPT###';
            script.onerror = function() {
                adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
            };
            script.onload = function () {
                adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
                SomeFunc1.setOption('debug', false);
                SomeFunc1.setOption('baitClass', 'pub_300x250 propel-ad adfox rtb pub_300x250m dfp-slot__banner dfp-slot__placeholder dfp-slot__placeholder-text pub_teasers pud_ads pub_300x600 center_adsense advertorial-block hr-ads adboxbot pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links');
                SomeFunc1.onDetected(function () {
                    adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
                });
                 SomeFunc1.onNotDetected(function () {
                 });
            };
            document.documentElement.appendChild(script);
        } catch (err) {}
    });
</script>  

I need to do only one thing among 3:
1) OR Disable (delete\replace) array of commands in a whole block "script"
2) OR Delete EventListener (not using deleteEventListener because it doesn't work here)
3) OR Forbid geting script from URL in line 6 (Not desirable solution, because it may has no effect)

(Attachment: File with code that given before but with spaces and tabs to better viewing)

Viestejä yhteensä

  • maybe you can add the link of line 6 onto ublock Orign or Adblock or other blocker if you has some feature of the link address. ScriptManager inject the script after the DOMContentLoaded event, so it too late to block a script on the html dom if you use a script from scriptManager

  • editoi April 23 [?]

    for example, you can make the usage of this one
    prefs.js:
    user_pref("capability.policy.policynames", "killfunction");
    user_pref("capability.policy.killfunction.freeaccountsonline.open", "noAccess");
    user_pref("capability.policy.killfunction.XMLHttpRequest.open", "noAccess");
    user_pref("capability.policy.killfunction.XMLHttpRequest.send", "noAccess");
    user_pref("capability.policy.killfunction.sites", http://evilsite.org);

Kirjaudu sisään tai Rekisteröidy kommentoidaksesi.