Only on Firefox "Loading failed for the <script> with source"

127,690

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.

Share:
127,690

Related videos on Youtube

Narek Tootikian
Author by

Narek Tootikian

I am Software Engineering Team Lead with Computer, Information Science Masters degree.

Updated on May 04, 2022

Comments

  • Narek Tootikian
    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
      ScaisEdge over 6 years
      have you tried to refresh the browser? .. round arrows at right of the url bar
    • Narek Tootikian
      Narek Tootikian over 6 years
      Yes, I refreshed the browser and when copy/past the url to another tab it loads content.
    • ScaisEdge
      ScaisEdge over 6 years
      another tab .. in the same browser work ?
    • Narek Tootikian
      Narek Tootikian over 6 years
      I 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
      Admin about 6 years
      Shouldn't it throw an error? The source is valid, and the response is incorrectly formatted JSON.
    • Admin
      Admin about 6 years
      Have you tried using Incognito Mode?
    • Narek Tootikian
      Narek Tootikian about 6 years
      Incognito mode doesn't help.
    • Christian Vincenzo Traina
      Christian Vincenzo Traina over 5 years
      It would interesting if there was a way to catch the error
    • Cerin
      Cerin over 4 years
      I 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
      ajaristi over 4 years
      I had the same problem due to the script path did not exist. After I corrected the script path, that message dissapeared.
    • sihaya
      sihaya over 4 years
      Also try opening the Network tab in the developer console and look for requests that have a status >= 400.
    • Thaps
      Thaps about 4 years
      I 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
      Thaps about 4 years
      When 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
      Aseem over 3 years
      I had same issue on Firefox. Did not test on chrome. I restarted my django server and it worked
    • CrazyVideoGamer
      CrazyVideoGamer about 3 years
      Just fyi, this error occured when I was importing, but there wasn't the .js extension at the end (I wasn't using webpack)
  • linusg
    linusg over 6 years
    Man, how would one think of this? -_-
  • Didier L
    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
    linusg over 6 years
    I 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
    Ari over 6 years
    I don't even have adblock plus installed, why should it always be blamed?
  • Didier L
    Didier L over 6 years
    @KeepMove Indeed it might be something else. The previous comment reported the case for uBlock Origin.
  • Rodrigo Reis
    Rodrigo Reis over 6 years
    I don't have uBlock installed and I'm receiving this error while loading firebase script.
  • Didier L
    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
    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
    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
    R. Schreurs over 6 years
    It would be nice if these tools reported blocking to the console.
  • Didier L
    Didier L over 6 years
    @R.Schreurs you should report this feature request to them ;-)
  • R. Schreurs
    R. Schreurs over 6 years
    @DidierL, I'll make the effort if my comment has been upvoted 10 times :-)
  • bingeScripter
    bingeScripter about 6 years
    In 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
    Didier L about 6 years
    @bingeScripter Have you tried reproducing the issue with Firefox in safe mode? (c.f. the answer)
  • Admin
    Admin about 6 years
    p.s I have Ublock Origin and can connect to the file.
  • Narek Tootikian
    Narek Tootikian about 6 years
    I 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
    Admin about 6 years
    It must be some Firefox feature then, go to Bugzilla and open a ticket.
  • Andrew Gaul
    Andrew Gaul about 6 years
    I had to disable Privacy Badger to load cdn.datatables.net.
  • br4nnigan
    br4nnigan almost 6 years
    Now I feel dumb. It was indeed uBlock Origin
  • Gellie Ann
    Gellie Ann about 5 years
    @R.Schreurs You can now report it twice.
  • MikeHoss
    MikeHoss over 4 years
    I had the exact same problem. Privacy Badger seems to block the DataTables CDN
  • Andy P
    Andy P almost 3 years
    Thanks for this! In my case, DuckDuckGo Privacy Essentials was preventing javascript loading from widget.trustpilot.com
  • Jakub Bochenski
    Jakub Bochenski over 2 years
    @R.Schreurs where is the feature request? :)
  • Andrew S
    Andrew S over 2 years
    It 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
    Andrew S over 2 years
    Please explain to the readers what a cdn link is and you may get more upvotes.
  • Aziz Saleh
    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 was application/json by default. Hope this helps.
  • Anna Kleiner
    Anna Kleiner over 2 years
    In 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
    nchopra over 2 years
    There's no way I would've thought of this; years down the line your answer is still helping people, thanks a ton!
  • Didier L
    Didier L over 2 years
    @nchopra It feels like it was yesterday 😉