How to disable a specific javascript function?

Everything about using Adblock Plus on Google Chrome

How to disable a specific javascript function?

Postby JD2 » Sat Aug 17, 2013 7:02 am

I have AdBlock Plus v1.5.4 for Chrome.

I would like to block the following javascript function that is contained in a webpage. I do not want to block the rest of the page. The javascript script is as follows:

<script type="text/javascript">

function TestPage() {
if ($('.myTestAd').height() == 0)
window.location = "http://<redacted>/adblock.php?link=<redacted>";
}

$(TestPage);

</script>

I assume that simply removing or blocking "$(TestPage);" on this page would prevent this script from being executed. However I don't know how to write the rule to block it as this is not a <div> element.

So, does anyone know how to write the rule to block this specific script?
JD2
 
Posts: 7
Joined: Sat Aug 17, 2013 6:54 am

Re: How to disable a specific javascript function?

Postby mapx » Sat Aug 17, 2013 8:33 am

an inline script (in HTML) can not be blocked; you can block only an external script

you can write a userscript and use it directly in chrome (drag & drop it in the extensions page) or using some script manager (like greasemonkey for firefox or Tampermonkey for chrome)

see also
https://userscripts.org/
User avatar
mapx
 
Posts: 21947
Joined: Thu Jan 06, 2011 3:01 pm

Re: How to disable a specific javascript function?

Postby JD2 » Sun Aug 18, 2013 10:13 am

Thanks for the info!

The script at https://userscripts.org/scripts/show/155840 along with the Tampermonkey extension for Chrome did the trick.
JD2
 
Posts: 7
Joined: Sat Aug 17, 2013 6:54 am

Re: How to disable a specific javascript function?

Postby BoyBlueSky » Sun Nov 17, 2019 9:20 pm

The UserScripts.org site is down,
but there is a static mirror of the site.
So, the previously mentioned link:
https://userscripts.org/scripts/show/155840
can instead be found at:
https://userscripts-mirror.org/scripts/review/155840
^_^
BoyBlueSky
 
Posts: 1
Joined: Sun Nov 17, 2019 9:16 pm


Return to Adblock Plus for Chrome support

Who is online

Users browsing this forum: No registered users and 17 guests