javascript 在位于本地文件系统上的 html 文件上运行 Greasemonkey 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9931115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run Greasemonkey on html files located on the local filesystem?
提问by Niklas R
I have an API documentation lying around on my Harddrive and to ease my workflow, I have written a simple script that modifies the page for my needs. I've developed it using FireBug on FireFox.
我的硬盘上有一个 API 文档,为了简化我的工作流程,我编写了一个简单的脚本来根据我的需要修改页面。我在 FireFox 上使用 FireBug 开发了它。
@include
-ing webpages works correctly, but Greasemonkey does not seem to detect pages on the local file-system?
@include
-ing 网页工作正常,但 Greasemonkey 似乎没有检测到本地文件系统上的页面?
I would like to have an include like
我想要一个包含像
// @include *R13/Python*R13/*
Which should match for example
例如哪个应该匹配
file:///Z:/Eigene%20Dateien/Cinema4D/Documentations/R13/Python%20R13/modules/c4d/index.html
But it is not recognized. How can I achieve that the userscript runs on local html files, too?
但它不被认可。我怎样才能实现用户脚本也可以在本地 html 文件上运行?
Thanks in advance,
提前致谢,
回答by Mikey G
Since a couple of releases there are two new 'hidden' preferences:
greasemonkey.aboutIsGreaseable
greasemonkey.fileIsGreaseableThe default value is "false". If you want Greasemonkey to run on file:/// urls, you have to set the second one to "true" (in about:config).
由于几个版本有两个新的“隐藏”首选项:
greasemonkey.aboutIsGreaseable
greasemonkey.fileIsGreaseable默认值为“假”。如果您希望 Greasemonkey 在 file:/// urls 上运行,您必须将第二个设置为“true”(在 about:config 中)。
Quoted from here:
从这里引用:
回答by samstav
tampermonkey
篡改猴子
If you're here for the same reason I am, which is -> looking for the tampermonkeyequivalent, (and you're using Chrome)... go to Chrome Preferences -> Extensions, aka chrome://extensions/, and you'll see Allow access to file URLs
如果你来这里的原因和我一样,那就是 -> 寻找等效的tampermonkey,(并且你正在使用 Chrome)......转到 Chrome 首选项 -> 扩展程序,又名 chrome://extensions/,然后你会看到 允许访问文件 URL