bigpreshy
bigpreshy

Reputation: 31

How to affect the dom in chrome extension making

I am trying to do a chrome extension.

What I am basically try to do is implement : document.designMode = ‘on’. I don’t want to always have to go to the console from the browser to do this. I have gone far with building the extension, but the problem is that once I click on it. The script I wrote is just affecting the popup.html file.

It is not affecting the particular site.

Upvotes: 1

Views: 140

Answers (1)

Andy K
Andy K

Reputation: 7292

  • Create content.js file;
  • Inside content.js add JS code to run on site;
  • Include code to manifest.json:
"content_scripts": [
    {
      "matches": [
        // add site urls where you want to run your extension
      ],
      "all_frames": true,
      "js": [
        "content.js" // here's your js
      ]
    }
  ],
  "permissions" : [
    "declarativeContent"
  ],

Upvotes: 1

Related Questions