将Chrome扩展程序限制为某些网址? [英] Limit Chrome Extension to certain URLs?

查看:160
本文介绍了将Chrome扩展程序限制为某些网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法限制Chrome扩展程序只能在某些网址上运行?

Is there a way to limit a Chrome extension to only run on certain urls?

假设我只希望扩展程序在Amazon.com上运行。我意识到你可以在脚本的顶部进行检查,然后只在检查匹配的情况下执行脚本的其余部分。

Say I want the extension to run only if the domain is Amazon.com. I realize you can put a check at the top of the scripts, then execute the rest of the script only if the check matches.

但是,是否可以阻止扩展运行在所有?

However, can you prevent the extension from running at all?

推荐答案

Welp,它数字我会发布问题后发现这个权利的答案,即使我有卡住了一段时间......

Welp, it figures I would find the answer to this right after posting the question, even though I have been stuck for a while...

http://code.google.com/chrome/extensions/content_scripts.html

在manifest.json中:

In manifest.json:

"content_scripts": [
    {
      "matches": [...urls...],
      "exclude_matches": [...urls...],
      "css": [...]
    }
]

这篇关于将Chrome扩展程序限制为某些网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆