Citizen SP
Citizen SP

Reputation: 1411

Chrome extension: How to change html of the page?

I'm using the following script within a Chrome extension I made. It replaces "old text" with "new text" of all pages.

document.body.innerHTML = document.body.innerHTML.replace(new RegExp("old text", "g"), "new text");

So far, so good. But want to know how to find/replace the (java)scripts, meta tags and css files in within the tags of the page in the same way.

Upvotes: 2

Views: 1412

Answers (1)

Alexander Pavlov
Alexander Pavlov

Reputation: 32306

The stuff you are looking for resides in document.head.

Upvotes: 1

Related Questions