119

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.

15
  • have you tried to refresh the browser? .. round arrows at right of the url bar
    – ScaisEdge
    Commented Aug 25, 2017 at 10:48
  • Yes, I refreshed the browser and when copy/past the url to another tab it loads content. Commented Aug 25, 2017 at 11:08
  • another tab .. in the same browser work ?
    – ScaisEdge
    Commented Aug 25, 2017 at 11:10
  • 2
    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. Commented Aug 25, 2017 at 11:18
  • 1
    Also try opening the Network tab in the developer console and look for requests that have a status >= 400.
    – sihaya
    Commented Dec 16, 2019 at 22:42

19 Answers 19

179

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).
24
  • 8
    Man, how would one think of this? -_-
    – linusg
    Commented Nov 5, 2017 at 0:58
  • 1
    @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.
    – Didier L
    Commented Nov 5, 2017 at 12:50
  • 1
    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!
    – linusg
    Commented Nov 5, 2017 at 14:49
  • 55
    It would be nice if these tools reported blocking to the console. Commented Jan 11, 2018 at 14:55
  • 3
    I had to disable Privacy Badger to load cdn.datatables.net. Commented Mar 25, 2018 at 2:48
18

I've just had the same issue - for me Privacy Badger on Firefox was the issue - not adblocker. Posting for posterity

1
  • 2
    I had the exact same problem. Privacy Badger seems to block the DataTables CDN
    – MikeHoss
    Commented Aug 10, 2019 at 17:34
9

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).

5

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.

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.

3

As suggested above, this could possibly be an issue with your browser extensions. Disable all of your extensions including Adblock, and then try again as the code is loading fine in my browser right now (Google Chrome - latest) so it's probably an issue on your end. Also, have you tried a different browser like shudders IE if you have it? Adblock is known to conflict with domain names with track and market in them as a blanket rule. Try using private browsing mode or safe mode.

3
  • 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. Commented Mar 12, 2018 at 7:44
  • It must be some Firefox feature then, go to Bugzilla and open a ticket.
    – user9016207
    Commented Mar 12, 2018 at 10:25
  • 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. Commented Dec 14, 2021 at 16:41
2

I ran into the same issue (exact error message) and after digging for a couple of hours, I found that the content header needs to be set to application/javascript instead of the application/json that I had. After changing that, it now works.

2
  • 1
    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
    Commented Nov 1, 2021 at 0:22
  • @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.
    – Aziz Saleh
    Commented Nov 2, 2021 at 1:08
2

VPNs can sometimes cause this error as well, if they provide some type of auto-blocking. Disabling the VPN worked for my case.

1

If the src is https and the certificate has expired -- and even if you've made an exception -- firefox will still display this error message, and you can see the exact reason why if you look at the request under the network tab.

1

I had the same issue with firefox, when I searched for a solution I didn't find anything, but then I tried to load the script from a cdn, it worked properly, so I think you should try loading it from a cdn link, I mean if you are trying to load a script that you havn't created. because in my case, when tried to load a script that is mine, it worked and imported successfully, for now I don't know why, but I think there is something in the scripts from network, so just try cdn, you won't lose anything.

I wish it help you.

1
  • Please explain to the readers what a cdn link is and you may get more upvotes.
    – Andrew S
    Commented Nov 1, 2021 at 0:25
1

I ran in the same situation and the script was correctly loading in safe mode. However, disabling all the Add-ons and other Firefox security features didn't help. One thing I tried, and this was the solution in my case, was to temporary disable the cache from the developer window for this particular request. After I saw this was the cause, I wiped out the cache for that site and everything started word normally.

1

I've had the same problem and the culprit was the "I don't care about cookies" Firefox addon. Like another user here, I'm posting for posterity.

0

This could also be a simple syntax error. I had a syntax error which threw on FF but not Chrome as follows:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
        defer
    </script>
0
0

I've just run into this issue while building Facebook Login into my ASP.NET project.

It turned out to be an extension called Facebook Container, which blocks the Facebook SDK script unless you add an exception for the site in question.

Once I added the exception it all worked fine.

0

Ran into the same problem today. It turned out that there was no storage space left on the VM the site was running on and therefore requests weren't completely handled anymore.

After cleaning things up (notably Docker-related stuff), everything works fine again.

0

For me it wasn't AdBlock, but actually a wrong relative path. Wrong error message I guess. I was able to see this in the server logs.

0

For me it was NoScript extension which was installed by default by my company. I configured localhost to be safe, then it worked.

0

I faced this issue recently I have no plugins so the thing that I did was clear caches and everything is okay.

-1

For me (Next.js project static export) it was due to cache. I did a hard refresh Ctrl + F5 and everything started working fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.