cmcginty
cmcginty

Reputation: 117028

Can a Greasemonkey script override AdBlock filters?

I have a Greasemonkey script that is trying to access an HTML element that Adblock is disabling. Is it possible to create a workaround with the Greasemonkey script to prevent conflicts with the Adblock plugin?

I'm open to any ideas, however changing the script to avoid the Adblock element is not a solution at this time.

Additional Info

The addblock element I am trying to "enable" is a Table element from a google search result.

<table id="mbEnd" width="30%" style="margin-bottom: 1em;">

The Adblock filter hiding the element is:

google.com,google.com.au,google.co.uk,google.ca,google.se#table(id=mbEnd)(width=30%)

Update: Some are suggesting that I simply disable the adblock filter for the page I am working on. I also consider this a non-solution, since anyone using my script would have to perform the same action, and I can not expect all my users to manually modify their Adblock settings.

Upvotes: 2

Views: 2115

Answers (2)

Daniel X Moore
Daniel X Moore

Reputation: 15060

What type of elements are you trying to access? Most of the page elements should still be available, just with 'display: none;'.

I use jQuery in my Greasemonkey scripts and it is able to get the alt text from an image after I have disabled it with ABP.

$('#s1 + img')[0].alt
=> Rohm and Haas Paint Quality Institute

If you provide some more specific information I may be able to provide a more specific solution.

Accessing iframes that are blocked may be harder but doable. Again, more specifics will help me answer.

Upvotes: 0

Dan Lew
Dan Lew

Reputation: 87430

You can disable adblock for specific pages or domains. Just click the arrow next to the symbol and it'll give you more options for disabling adblock.

There is no way to make a Greasemonkey script automatically override Adblock, as Adblock affects the page before any Greasemonkey scripts are loaded.

Upvotes: 1

Related Questions