Suddenly, and inexplicably, when my website development environment (Visual Studio 2022) attempted to load a webpage using Firefox Developer Edition Browser, the browser refused to load JavaScript files that were contained in another directory. The webpage was on my development machine. The file(s) that would not load was on the same development machine. After many hours I realized that the browser would not load the files because of a CORS error.
The website structure is depicted below. Directories are bold.
A user who accesses gggustafson.com, will enter the website at index.html. index.html in turn redirects the user to gggustafson.html. Besides its actual content, gggustafson.html contains
<script src="scripts/global.js" ></script>
<script src="scripts/utilities.js" ></script>
<script src="scripts/master_page.js" ></script>
<script>
window.onload =
function ( )
{
Global.initialize_globals ( );
MasterPage.build_page ( PAGE_COMPONENTS );
};
window.onunload =
function ( )
{
};
</script>
When the browser encounters Global.initialize_globals ( ); it cannot find the symbol Global (defined in the file global.js). On investigation it appears that the browser treats the loading of the global.js file as a security issue. The solution that I used was to set security.fileuri.strict_origin_policy in about:config to false. To me as a developer, this solution does not feel right.
I agree with Mozilla in protecting against CORS. But for developers the Mozilla policy forces unreasonable requirements. I suggest the following.
In the Firefox Developer Edition Browser, and only in that browser, add a preference to about:config that allows a developer to cause the browser to ignore CORS issues for files on the local machine, and only on the local machine.