Can Greasemonkey work with the file:// protocol?

旧城冷巷雨未停 提交于 2019-11-30 20:18:21

See "Greaseable schemes" in the Greasemonkey docs. Greasemonkey ignores the file:// protocol by default.

For scripts to work with file:// paths, you need to open about:config and set extensions.greasemonkey.fileIsGreaseable to true.

You might possibly have to restart Firefox for this setting to take effect.



Also, // @include http* file* is invalid syntax. You would use:

// @include     http://*
// @include     https://*
// @include     file://*

except, avoid using such global includes as much as you can. Tune to the script to just the domain(s) and/or page(s) you explicitly target.

This: avoids unexpected side effects, increases performance, and reduces the chances of being pwned by some "zero day" exploit.


I also recommend that you delete the User Settings options for scripts you write yourself. This will only lead to heartache and confusion later. ;) Use the metadata section of the script, only, for scripts you control.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!