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?
Yes, 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With