Chrome扩展Manifest中content_script排除匹配失效问题求助
Fixing Chrome Extension Content Script Exclusion for Pipedrive Subdomains
I’ve run into this exact matching rule quirk with Chrome extensions before, so let’s break down why your current setup isn’t working and how to fix it.
First, here’s your original configuration snippet for reference:
{ "matches": [ "*://*.pipedrive.com/*" ], "exclude_globs": [ "://www.pipedrive.com/*" ], "css": [ "content/callbox.css", "content/pipedrive/pipedrive.css" ], "js": [ "assets/js/jssip-2.0.6.min.js", "content/message.js", "content/callbox.js", "content/pipedrive/pipedrive.js" ] }
Why Your Exclusions Aren’t Taking Effect
- Invalid
exclude_globssyntax: The pattern you used (://www.pipedrive.com/*) is missing a leading wildcard*, which Chrome requires to recognize it as a valid URL glob. Without that leading*, the browser can’t map the pattern to full URLs. exclude_matchesis more reliable for domain exclusions: Whileexclude_globsworks for string-based URL matching,exclude_matchesuses the same pattern syntax as yourmatchesfield. This makes it more predictable and higher-priority for domain-specific exclusions like yours.
The Working Fixes
Option 1: Use exclude_matches (Recommended)
Replace your exclude_globs line with a properly formatted exclude_matches entry. This will explicitly exclude all paths on www.pipedrive.com while keeping your subdomain matches intact:
{ "matches": [ "*://*.pipedrive.com/*" ], "exclude_matches": [ "*://www.pipedrive.com/*" ], "css": [ "content/callbox.css", "content/pipedrive/pipedrive.css" ], "js": [ "assets/js/jssip-2.0.6.min.js", "content/message.js", "content/callbox.js", "content/pipedrive/pipedrive.js" ] }
Option 2: Fix the exclude_globs Syntax
If you prefer to stick with exclude_globs, just add the leading wildcard to your pattern:
{ "matches": [ "*://*.pipedrive.com/*" ], "exclude_globs": [ "*://www.pipedrive.com/*" ], "css": [ "content/callbox.css", "content/pipedrive/pipedrive.css" ], "js": [ "assets/js/jssip-2.0.6.min.js", "content/message.js", "content/callbox.js", "content/pipedrive/pipedrive.js" ] }
Quick Troubleshooting Tips
- Reload your extension: After updating the manifest, head to
chrome://extensions/, enable developer mode, and click the reload button for your extension to apply the new rules. - Clear site cache: Old cached content can sometimes interfere with new matching rules—clear your browser cache for Pipedrive sites to avoid conflicts.
- Check for conflicting rules: Make sure there aren’t other content script blocks in your manifest that might be targeting
www.pipedrive.comdirectly.
内容的提问来源于stack exchange,提问作者necroface
相关产品推荐
相关产品推荐

