Douglas
Douglas

Reputation: 745

Make Google Chrome Extension Always apply to Site X

I have created a small extension that applies a simple css file to a website.

Currently though, it applies to ALL websites, and only applies when I click the icon for my extension.

I need it to always apply to one particular site

I think it's something up with my manifest.json:

{
"manifest_version": 2,

"name": "UI",
"description": "UI alter",
"version": "1.0",

"permissions": [
    "tabs",
    "activeTab",
    "http://thewebsite.com"
],
"background": {
    "scripts": ["override.js"],
    "persistent": true
},
"browser_action": {
    "default_icon": "icon.png",
    "default_title": "change ui"
}

}

Upvotes: 0

Views: 37

Answers (1)

GôTô
GôTô

Reputation: 8053

You need to use a content script instead, and use a matches parameter in your manifest:

"content_scripts": [
  {
    "matches": ["http://www.google.com/*"],
    "css": ["mystyles.css"],
    "js": ["jquery.js", "myscript.js"]
  }
],

See Doc

Upvotes: 1

Related Questions