RequireJS : Uncaught Error - Script Error for a module - javascript

Would like to share this issue I recently debugged.
I was getting this error in Chrome console for a particular page.
Debugged the script - No error, actually the script is working correctly in some other modules and components.
"officeUtilities" script is not loading due to this error.

Although I couldn't fix it in the active session of browser, following worked for me.
- Opening page in Chrome incognito mode and other browsers (Firefox, Edge, IE).
I think it is caching issue. I deleted all browser cached images and files , but that didn't work. I didn't tried to delete all history, that will end up logging out of multiple sites.
Since I found a alternative way to test the page, I'm Okay with it.

Related

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

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.
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).
I've just had the same issue - for me Privacy Badger on Firefox was the issue - not adblocker. Posting for posterity
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).
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.
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.
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.
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.
VPNs can sometimes cause this error as well, if they provide some type of auto-blocking. Disabling the VPN worked for my case.
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.
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.
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.
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.
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>
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.
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.
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.
For me it was NoScript extension which was installed by default by my company. I configured localhost to be safe, then it worked.
For me (Next.js project static export) it was due to cache. I did a hard refresh Ctrl + F5 and everything started working fine.

Chrome SecurityError loading jQuery Mobile page from local file system

I get the following error in Chrome when loading a trivially simple html file with a jQuery Mobile reference. The error is not present with just the jQuery reference.
Uncaught SecurityError: Failed to execute 'replaceState' on 'History':
A history state object with URL 'http://stacksnippets.net/js' cannot
be created in a document with origin 'null'.
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
</head>
<body></body>
</html>
You can also "Run code snippet" and see the error in the console.
This error did not happen before today. I have not changed my code or method of loading the html file in the browser. It used to work perfectly - I use the same code for all my PhoneGap apps.
Does anyone know if there was a Chrome security update that causes this SecurityError or whether I'm missing something? How would you go about debugging this? Thank you.
UPDATE
This discussion I think points out what is going on, which I suspected, since the error does not appear when running with a web server: Origin null is not allowed by Access-Control-Allow-Origin .
But I am still wondering why this changed in the past day, whether Chrome has had a change in their security policy, or why it was working before, and whether any of my PhoneGap apps will be affected.
This error is same as the origin is null error. This error occurs because of the security feature of Chrome.
A simple solution to test the application is to bypass this security on chrome.
Steps:
create a chrome browser shortcut on desktop.
Close all the instances of chrome on your machine.
Right click on the desktop shortcut of chrome and click on Properties.
in Target field, append " -allow-file-access-from-files" at the end.
Save and close properties.
Open chrome via this shortcut only.
Hurry, the error has gone. App works perfectly.
NOTE: This is just a work-around I use to test my cordova apps on desktop browser for UI testing.
Temporary solution: I've commented out all history.replaceState calls in jquery mobile, didn't need to manipulate browser history in my app anyways.
I wonder if it's chrome security bug or model and future behavior.
On a Mac I was able to fix this by running a webserver instead of loading it from a "file://" url:
http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450?utm_expid=66866090-49.VYy4WCNHSyuP6EmjnM93MQ.0&utm_referrer=https%3A%2F%2Fwww.google.com%2F
python -m SimpleHTTPServer 8000
In the directory should make it available from Chrome via 0.0.0.0
I don't seem to have the same problem, not on the stable version of Chrome (45) or the Dev version (47).
However, I have personally seen issues with the CORS header, too. If you can cause the problem to happen reliably, I suggest filing a bug at crbug.com and a Chrome developer will have a look at it.

Hiding Script Errors popups in IE8

I have inherited an application that download a js code from another place and with the help of the
IWebBrowser2 interface in Windows it runs this js in that browser inside a hWindow.
While i run the app on the machines with IE9 and IE10 no popups with script errors. When i run the app in a machine with IE8 i can see a script error message appears. I tried to disable the script errors inside the Internet options advanced tab and also cleared the Enable 3-party browser extensions.
Those didn't help to suppress the script Error. Perhaps, someone knows how i can get rid of the script error in IE8.

Chrome Developer Tools can't see javascript

So I am having this really weird thing where my javascript doesn't show in my sources window. If I set a debugger in my js and then reload the page, it will break and I can see the javascript. The weird thing is that instead of the tab being labeled MyJavascriptFile.js it reads [VM](62) or some other number. I have tried reinstalling chrome and it didnt fix my problem. It didn't used to be like this, any ideas what is going on? Its just really annoying to have get to my javascript by adding debugger statements.
I'm having this problem right now. Must be a bug in Chrome. All you have to do is load the console (f12) then reload the page whilst the console is loaded. You can now see your code.
The weird thing is that instead of the tab being labeled MyJavascriptFile.js it reads VM or some other number.
This is because you are accessing your script through localhost, and therefore running into security policies. If you host your file at an IP or domain name, you'll be able to debug normally again.

Chrome Console Error: chromeHidden.Port.dispatchOnDisconnect

NO idea what that means. Been developing some facebook apps and some apparently related js errors show up.
According to this thread it's a lazy load issue. I am running chrome with the default settings though.
http://code.google.com/p/chromium/issues/detail?id=100977
Once and a while (about one in five times) this breaks facebook app authentication. chromeHidden.Port.dispatchOnDisconnect shows up like 8 times sequentially in the console, with no indicator of what code is breaking.
Anyone else encounter this, or know exactly what causes it? Is it javascript bugs from facebooks? Some sort of protocol error? Port mismatch?
Mine was due to the chrome2phone extension
If you've disabled an extension and the problem no longer persists, please file a bug against the extension (probably most pertinent) or the Chromium forum (http://code.google.com/p/chromium/).

Categories

Resources