Let's say you're making a userscript that opens some external app. Let's say Discord.
So you put this code into your userscript:
location.assign("discord://-");
Okay neat. But when it executes, you're greeted with this:
There's no checkbox to have it always open in Discord, like it usually does with some other apps. How inconvenient!
From what I can tell, the issue is due to your userscript manager technically being the one trying to open the app. Firefox likely doesn't support storing the "always allow" option for your userscript manager, so it's just not present.
It's an easy fix though!
In your header, grant unsafeWindow:
// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 2025-05-26 // @description try to take over the world! // @author You // @match *://*/* + // @grant unsafeWindow // ==/UserScript==
And in your code, use the location.assign
on unsafeWindow
instead:
unsafeWindow.location.assign("discord://-");
That's it! It should let you always allow it now: