I like to keep my personal userscripts on local storage that syncs to the cloud. What I have been doing in the past is simply backing them up but then I realized I can use the @require tag to link to my local version of the file which I can then edit in my IDE.

This worked for a while but stopped working for some reason about 2 years ago and I would like to solve this issue as I am using userscripts more and more these days.

I'm using Google Chrome, Tampermonkey and MacOS.

Here is an example of my userscript code. Please be advised that I'm certain the path is correct.

// ==UserScript==
// @name         Google Mods
// @run-at       document-start
// @namespace    http://google.com/
// @version      1.00
// @description  Google mods
// @author       John Doe
// @match        https://*.google.com/*
// @require      file://⁨/Users/johndoe/Desktop/google.user.js
// ==/UserScript==

When I look at the console when viewing the page I can tell that it is attempting to load the script but cannot find it. This is what the error looks like

Tampermonkey: couldn't load @require from forbidden URL file://⁨/Users/johndoe/Desktop/google.user.js

Any help as to what I am missing would be greatly appreciated.

EDIT: To be clear I have the extension setting Allow access to file URLs enabled.

2

There are 2 best solutions below

3
erosman On

By default, extensions in modern browsers do not have access to local file system for security reasons. Therefore, the userscript manager will not be able to load file://⁨/Users/johndoe/Desktop/google.user.js

Greasemonkey is a Firefox extension and on Firefox there is no option to allow file system access.

As explained by wOxxOm, on Tampermonkey for Chrome it is possible to allow access to allow access to local file URIs.

More info: Chrome extension - how to access local file:// with manifest v3

0
Andy Romero On
  1. Type in the chrome search bar: chrome://extensions.
  2. Then search for: Tampermonkey.
  3. When you find the tampermonkey extension click on details.
  4. Navigate almost to the end and enable the option: allow access to file urls.

I hope it helps, greetings

search tampermonkey enable the option to allow URLs