Frage

I want to remove all special attributes in a page with adblock. For example, remove title attribute like this:

<p title="Free Web tutorials">W3Schools.com</p>

becomes:

<p>W3Schools.com</p>
War es hilfreich?

Lösung

I hope I understood your question correctly: Most Adblockers use the same filters rules and Adblock Plus has a nice tutorial on what’s possible and what’s not. The gist is: You can hide things, but rewriting the page is not possible.

What you want to do can be achieved by a UserScript easily. Generally speaking, it is a piece of JavaScript that is run on certain webpages, and you can import that UserScript in Chrome. (Name it something.user.js and drag it into Chrome’s extension list or use the Tampermonkey extension).

Here’s a random example that should get you started: https://userscripts.org/scripts/review/102001

The top is metadata and controls on which sites the script should be run. The code inside the start-function is going to be executed in the page’s context. This is where you need to place your code to modify the webpage. The block of code at the bottom is used to insert the start function into the page.

Please note: If you want to use jQuery within the start function, it needs to be loaded by the page. If it isn’t, you need to insert a <script> tag into the page that loads jQuery for you.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top