Only on Firefox "Loading failed for the <script> with source"
Solution 1
I just had the same issue on an application that is loading a script with a relative path.
It appeared the script was simply blocked by Adblock Plus.
Try to disable your ad/script blocker (Adblock, uBlock Origin, Privacy Badger…) or relocate the script such that it does not match your ad blocker's rules.
If you don't have such a plugin installed, try to reproduce the issue while running Firefox in safe mode.
- If you cannot reproduce it in safe mode, it means your issue is linked to one of your plugins or settings.
- Otherwise, it might be a different issue. Make sure you have the same error message as in the question. Also look at the network tab of the developer tools to check if your script is listed (reload the page first if needed).
Solution 2
I've just had the same issue - for me Privacy Badger on Firefox was the issue - not adblocker. Posting for posterity
Solution 3
I noticed that in Firefox this can happen when requests are aborted (switching page or quickly refreshing page), but it is hard to reproduce the error even if I try to.
Other possible reasons: cert related issues and this one talks about blockers (as other answers stated).
Solution 4
Today I ran into the exact same problem while working on a progressive web app (PWA) page and deleting some cache and service worker data for that page from Firefox. The dev console reported that none of the 4 Javascript files on the page would load anymore. The problem persisted in Safe mode, so it was not an add-on issue. The same script files loaded fine from other web pages on the same website. No amount of clearing the Firefox cache or wiping web page data from Firefox would help, nor would rebooting the Windows 10 PC. Chrome all the time worked fine on the problem page. In the end I did a restore of the entire Firefox profile folder from a day-old backup, and the problem was immediately gone, so it was not a problem with my PWA app. Apparently something in Firefox got corrupted.
Solution 5
I had the same problem (different web app though) with the error message and it turned out to be the MIME-Type for .js files was text/x-js
instead of application/javascript
due to a duplicate entry in mime.types on the server that was responsible for serving the js files. It seems that this is happening if the header X-Content-Type-Options: nosniff
is set, which makes Firefox (and Chrome) block the content of the js files.
Related videos on Youtube
Narek Tootikian
I am Software Engineering Team Lead with Computer, Information Science Masters degree.
Updated on May 04, 2022Comments
-
Narek Tootikian about 2 years
I want to integrate Marketo form with my existing website on yii framework. My code works on all the browsers except Firefox.
Excerpt from my code:
$('#button').click(function () { var formData = { 'Email': $('#UserInfo_email').val(), 'FirstName': $('#UserInfo_first_name').val(), 'LastName': $('#UserInfo_last_name').val(), }; MktoForms2.loadForm('//app-ab23.marketo.com', mcId, formId, function (form) { var myForm = MktoForms2.allForms()[0]; myForm.addHiddenFields(formData); myForm.onSuccess(function (values, followUpUrl) { return false; }); myForm.submit(); }); });
I get error on Firefox only with message
Loading failed for the <script> with source “http://app-ab23.marketo.com/index.php/form/getForm?munchkinId=1111&form=1111&url=http%3A%2F%2Fblox.dev%2Fwizard%2Fmap&callback=jQuery110207175825035737486_1503656391790&_=1503656391791”.
other browsers do the job correctly
note: munchkinId and formId are changed for posting here.
-
ScaisEdge over 6 yearshave you tried to refresh the browser? .. round arrows at right of the url bar
-
Narek Tootikian over 6 yearsYes, I refreshed the browser and when copy/past the url to another tab it loads content.
-
ScaisEdge over 6 yearsanother tab .. in the same browser work ?
-
Narek Tootikian over 6 yearsI mean the url that fails to load and shows in the console error, loads in another tab but the page itself does not work.
-
Admin about 6 yearsShouldn't it throw an error? The source is valid, and the response is incorrectly formatted JSON.
-
Admin about 6 yearsHave you tried using Incognito Mode?
-
Narek Tootikian about 6 yearsIncognito mode doesn't help.
-
Christian Vincenzo Traina over 5 yearsIt would interesting if there was a way to catch the error
-
Cerin over 4 yearsI got this error trying to include a Google ad. Disabling the ad blocker wasn't enough, because Firefox blocks some links on its own. In recent versions of Firefox, if a domain it thought to be an ad, you need to whitelist both the domain hosting the link as well as the domain of the link itself. Once I whitelisted the domain hosting the JS link, then Firefox allowed it.
-
ajaristi over 4 yearsI had the same problem due to the script path did not exist. After I corrected the script path, that message dissapeared.
-
sihaya over 4 yearsAlso try opening the Network tab in the developer console and look for requests that have a status >= 400.
-
Thaps about 4 yearsI have the same problem on Firefox with 404 error in the Network console. Chrome gives me "net::ERR_ABORTED 404 (Not Found)". Problem is that I've double checked the url to the script several times and the file is in the correct place.
-
Thaps about 4 yearsWhen I replace the file reference with a different script file name containing the same code but in the same folder then the application runs. Something about calling the file "MobileLandscapeUIFactory.1.0.class.js" instead of "MobileUIFactory.1.1.class.js" in the src attribute of the script tag, causes the 404 error.
-
Aseem over 3 yearsI had same issue on Firefox. Did not test on chrome. I restarted my django server and it worked
-
CrazyVideoGamer about 3 yearsJust fyi, this error occured when I was importing, but there wasn't the .js extension at the end (I wasn't using webpack)
-
-
linusg over 6 yearsMan, how would one think of this? -_-
-
Didier L over 6 years@linusg I don't remember exactly but I know I looked at the network tab in the dev tools and I was confused because there was nothing at all for this script, even though the rest of the scripts were loaded. There had to be something blocking it upfront.
-
linusg over 6 yearsI had about one hour of confusion of this, no connections or whatsoever showing up in the network tab. Just XHR requests quitting with status 0. In the end it was uBlock Origin, after disabling it, my code worked like a charm. But without this answer I would have continued searching the source for hours, so many thanks!
-
Ari over 6 yearsI don't even have adblock plus installed, why should it always be blamed?
-
Didier L over 6 years@KeepMove Indeed it might be something else. The previous comment reported the case for uBlock Origin.
-
Rodrigo Reis over 6 yearsI don't have uBlock installed and I'm receiving this error while loading firebase script.
-
Didier L over 6 years@RodrigoReis it might be some other plugin as well, I don't have the full list. Try to run Firefox in safe mode to check if you can reproduce it. I edited the answer with more details about this.
-
Rodrigo Reis over 6 years@DidierL weird, no plugins installed, fresh Firefox install.. even on private mode the issue happens... i'll keep investigating
-
Didier L over 6 years@RodrigoReis I don't think private mode would affect this issue, it does not seem to be linked to cookies etc. Try safe mode instead. Don't hesitate to post your own answer if you find a different cause.
-
R. Schreurs over 6 yearsIt would be nice if these tools reported blocking to the console.
-
Didier L over 6 years@R.Schreurs you should report this feature request to them ;-)
-
R. Schreurs over 6 years@DidierL, I'll make the effort if my comment has been upvoted 10 times :-)
-
bingeScripter about 6 yearsIn my case at least, It's definitely not caused by an adblock plugin, firewall or relative paths, here is how the problem manifests it's self in my case: - The blocked script is hosted on a different domain so it's not relative. - The blocked script is indeed an advertising script, but for sure I have any installed plugins as I don't use firefox at all, just for debugging. - On the same page, I have multiple requests to the same domain / the same source but with different parameters, most of them don't get blocked, and on some refreshes nothing gets blocked.
-
Didier L about 6 years@bingeScripter Have you tried reproducing the issue with Firefox in safe mode? (c.f. the answer)
-
Admin about 6 yearsp.s I have Ublock Origin and can connect to the file.
-
Narek Tootikian about 6 yearsI tried all the possible stuff you suggested. The only thing I am thinking is the javascript engine. There must be some slightly minor stuff that causes the issue.
-
Admin about 6 yearsIt must be some Firefox feature then, go to Bugzilla and open a ticket.
-
Andrew Gaul about 6 yearsI had to disable Privacy Badger to load cdn.datatables.net.
-
br4nnigan almost 6 yearsNow I feel dumb. It was indeed uBlock Origin
-
Gellie Ann about 5 years@R.Schreurs You can now report it twice.
-
MikeHoss over 4 yearsI had the exact same problem. Privacy Badger seems to block the DataTables CDN
-
Andy P almost 3 yearsThanks for this! In my case, DuckDuckGo Privacy Essentials was preventing javascript loading from widget.trustpilot.com
-
Jakub Bochenski over 2 years@R.Schreurs where is the feature request? :)
-
Andrew S over 2 yearsIt would be very useful if you had mentioned the content header where, i.e. what tag, but as is this is not a useful response.
-
Andrew S over 2 yearsPlease explain to the readers what a cdn link is and you may get more upvotes.
-
Aziz Saleh over 2 years@AndrewS It really depends on what language you are using. When I ran into this It was on PHP, so I ended up just doing in the script response
header("Content-Type: application/javascript");
. Basically, my dynamic JS code was returning the wrong header. For some reason, it wasapplication/json
by default. Hope this helps. -
Anna Kleiner over 2 yearsIn my case it was the DuckDuckGo Privacy Essentials, that also blocks scripts that are considered trackers in private mode. However, the network tab does tell you that.
-
nchopra over 2 yearsThere's no way I would've thought of this; years down the line your answer is still helping people, thanks a ton!
-
Didier L over 2 years@nchopra It feels like it was yesterday 😉