I have tried to include some local Javascript (in the same folder as the GM script) and in both cases, the script fails to load and the scripts seems to stop working until I restart the browser even if the line with the @require is removed.
I tried both
// @require file://script.js
then
// @require file:///full/path/to/script.js
and both options don't work.
Is loading local Javascript banned in Greasemonkey or does it require some extra settings to enable it?
I have tried to include some local Javascript (in the same folder as the GM script) and in both cases, the script fails to load and the scripts seems to stop working until I restart the browser even if the line with the @require is removed.
I tried both
// @require file://script.js
then
// @require file:///full/path/to/script.js
and both options don't work.
Is loading local Javascript banned in Greasemonkey or does it require some extra settings to enable it?
Share Improve this question asked Dec 14, 2012 at 17:35 vfclistsvfclists 20.2k22 gold badges77 silver badges98 bronze badges 1- Firefox does block access to local files, you can enable it but i dont know if that will let greasemonkey do it too. kb.mozillazine.org/… – NickSlash Commented Dec 14, 2012 at 17:55
1 Answer
Reset to default 17Yes, you can @require
and @resource
local files, but the syntax has to be correct. Also, if the script is installed off a server and trying to @require
a local file, then extensions.greasemonkey.fileIsGreaseable
must be set to true
in about:config.
For JS in the same folder as the script:
// @require Local_Require_1.js
Or use a relative path:
// @require resources/Local_Require_2.js
A full path:
// @require file:///D:/Local_Require_3.js
Don't forget the drive letter on Windows.
Note that any or all parts of the @require
directive can be case-sensitive, depending on your OS. So, match case exactly.
Also note that when live-editing a script, especially changing @require
directives, the script may sometimes silently stop working. If that happens, close the target page tab, uninstall and reinstall the script.