Only on Firefox "Loading Failed for the <Script> with Source"

Loading failed for the script with source “http://localhost:8000/lib/js/jquery.emojiarea.js”

For me, following meta tag in header caused the problem:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

I removed the above meta tag and it worked fine.

Loading failed for scripts node js

First, check if Room.js is in the same directory as index.html on the web server. From your first error, it looks like the script file was not found.

If not, move them to the same directory or correct script tag in inde.html. If this won't work, see below for another possible solution.

Update after comment:

If JS file is in ./js/Room.js, you need to point the script in HTML file to it.

<script src="./js/Room.js"></script> 
<script>
function loadRoom(){
let room = new Room(name, o, obs, ep);
room.loadRoom();
}
</script>

Update after discussion:

The server (Express) loaded index.html in root and client in the subdirectory of the web server.

You can remove lines 5-7 (from your link) and replace them
with app.use(express.static(__dirname + "/client"));. This will load client to root of the web server.

Note that you would probably still get below error.


In the browsers, module is not defined, so module.exports would give the error and script will fail.

You should remove line module.exports = Room; from Room.js so the file will load correctly in the browser. But then it won't work in Node.js script, because function Room will not be exported from the file.

If you need to use the same file in Node.js and browser, I recommend you to use Gulp, Webpack, Browserify, Parcel or other web application bundler.

Firefox: Error loading script

If you're quickly clicking between links, you may simply be interrupting the load process of some of the GA scripts at different points (hence the randomness).

Perhaps when you do that and you get an error message, it may only apply to the page that was previously loaded.



Related Topics



Leave a reply



Submit