Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.18k stars 417 forks source link

[Firefox]: Access local files with @require & @resource directives #2150

Closed DerekZiemba closed 1 month ago

DerekZiemba commented 1 month ago

Attempted to migrate to Firefox from Chrome due to manifest v3 & the final straw, my Youtube script no longer works.
I moved everything over to firefox & imported/exported for every single extension. But none of my scripts are working in Firefox that work fine in Chrome!

Both Google & Bing are giving me nothing for the error below. I feel this should be a simple setting or something, but I can't find it, or ANYTHING about it that's more recent than 3-5 years ago / still applies. I've grown accustomed to modern search engines being crap, & these days AI needing to fill the gap, but even ChatGPT/BingAI doesn't have the answer.

Below is an example that works fine in Chrome. I can't figure out how to allow local file access in Firefox.

Expected Behavior

For @require & @resource directives to work with local files

Actual Behavior

Specifications

Script

(Please give an example of the script if applicable.)

derjanb commented 1 month ago

Duplicate of https://github.com/Tampermonkey/tampermonkey/issues/347#issuecomment-269039234

Sorry.

DerekZiemba commented 1 month ago

I believe this issue is different because I've used FF off and on & these scripts did work for several years. This is some recent change.

If I can get my old laptop to start up and not immediately BSOD or update FF, I can prove that they use to work.

derjanb commented 1 month ago

Local file support was possible by using a hack that has been fixed by Firefox (Windows first, and Linux much later). The official issue is the only way to ask for support if this.

DerekZiemba commented 1 month ago

That's disappointing. I was able to fix my chrome issues with the following, so guess I stick with chrome for now. It's pretty ridiculous this needs to be worked around since I could create the trusted policy literally just a few lines before .innerHTML = myhtml

window.trustedTypes.createPolicy('default', {
    createHTML: (string, sink) => string
});
someElement.innerHTML = window.trustedTypes.defaultPolicy.createHTML(text);
yavuzbehic commented 3 weeks ago

workaround: use xampp apache web server, start the server, then put your "script.js" in the htdocs folder. now you can use require. found this on my own because i was trying to get https://blog.exupero.org/live-reloading-tampermonkey-scripts/ to work on firefox. shoutout to my mobile dev instructor from uni.