简体   繁体   English

如何根据某些数据文件中保存的URL为Chrome扩展程序创建内容脚本?

[英]how do you make content scripts for Chrome extensions based on saved URL's from some data file?

Content scripts usually list the exact URL or a blanket acceptance of certain types of URl's Example below is for every webpage. 内容脚本通常会列出确切的URL或某些类型的URl的全面接受。下面的示例适用于每个网页。 I want the "matches" to be a data set. 我希望“匹配项”是数据集。 "manifest_version": 2, “ manifest_version”:2

"name": "Getting started example",
"description": "This extension shows a Google Image search result for the current page",
"version": "1.0",

"browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html "
},
"permissions": [
    "activeTab",
    "https://ajax.googleapis.com/"
],
"content_scripts": [
    { 
        "matches": ["*://*/*"]
    }
]

You can list the urls you want to use as an array: 您可以列出要用作数组的网址:

"content_scripts": [
    { 
        "matches": [
                       "http://www.google.com/*",
                       "http://stackoverflow.com/*"
                   ]
    }
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM