Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7796139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:16:50+00:00 2026-06-01T23:16:50+00:00

For content scripts in chrome extensions, you can specify matches and exclude_matches to control

  • 0

For content scripts in chrome extensions, you can specify matches and exclude_matches to control what pages they are injected in. This has to be specified in the manifest of the extension like this

{
  "name": "Color picker",
  ...
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "exclude_matches": ["http://www.google.com/*"],
      "css": ["color_picker.css"],
      "js": ["jquery.js", "color_picker.js"]
    }
  ],
  ...
}

I was wondering if I could add ["http://www.yahoo.com/*"],to exclude_matches as and when the extension is in use. This way, I can allow the user to control the exclude_matches

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:16:51+00:00Added an answer on June 1, 2026 at 11:16 pm

    An extension cannot modify any local files, including the extension’s manifest.json. Chrome offers an API for optional permissions, but this does not include Content scripts.

    You can manually create flexible patterns:

    // In the content script:
    var exclude = /^https?:\/\/(www\.)?yahoo\.com\//;
    if (!exclude.test(location.href)) {
         // Run logic.
    }
    

    Regular expressions are very powerful for this purpose, though not necessary. Instead of location.href, other location properties, such as location.host can be used.

    See also: MDN: window.location.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem controlling what pages my content scripts are injected into. The
Firefox has the Sandbox and evalInSandbox(). Chrome has sandboxed execution in their content scripts
I'm trying to create an extension using this docs: http://code.google.com/chrome/extensions/content_scripts.html I want a part
Can anyone tell me for chrome extensions how is possible for me to know
Using chrome content scripts I want to remove several iframes in a webpage before
I've got a chrome extension with a popup.html and an injected content script. With
I'm developing a scripting extension, similar to Greasemonkey or Chrome's content-script engine. This extension
Having a problem while passing messages using content scripts in Google chrome extension dev
I am a beginner with chrome extension. In my content_script.js, how can a get
I'm looking at the http://code.google.com/chrome/extensions/contentSecurityPolicy.html documentation and seeing: { ..., content_security_policy: script-src 'self' https://example.com;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.