noscript icon indicating copy to clipboard operation
noscript copied to clipboard

problems with file:/// URLs

Open scorpi11 opened this issue 1 month ago • 4 comments

I have a website which works when I use it via HTTPS. However, it is broken when I use the same website via file:///. This is a new problem that did not occur ~3 weeks ago.

It works fine when I disable NoScript.

Only a part of the JavaScript seems to work and I see JavaScript error messages that don't make sense, like an undefined variable which is clearly defined:

HTML code:

<script type='text/javascript' >
    var currentIndex = 1;
</script>

JavaScript error:

Uncaught ReferenceError: currentIndex is not defined

Other errors indicate that a script is executed twice for some reason:

Uncaught SyntaxError: redeclaration of const gallery_data

scorpi11 avatar Dec 06 '25 18:12 scorpi11

Could it be that separate JavaScript files are now isolated from each other when using file:// URLs?

I tried switching to a JavaScript module and using export/import of the required variables and functions. But this also doesn't work, as loading of JavaScript files with type="module" is blocked by CORS when using file:// URLs.

scorpi11 avatar Dec 06 '25 19:12 scorpi11

OK, this might be different from #489, but it's hard to say without looking at the actual code which triggers it.

Could you please share it? Thanks!

hackademix avatar Dec 11 '25 14:12 hackademix

A copy of the code can be found here:

https://tikei.de/~scorpi/demogallery/

It works when used with the above link, but doesn't work when used via file:///.

scorpi11 avatar Dec 11 '25 15:12 scorpi11

I re-checked with a fresh browser profile and it works fine. So there is something weird in my normal browser profile. I already reset NoScript to its default settings, but this didn't help.

scorpi11 avatar Dec 15 '25 15:12 scorpi11