PDA

View Full Version : Failed loading synchronously via XHR error?



alejandroNNU
12 Jun 2014, 12:44 PM
Hello,

I have a project that's giving me the following warning/error from ext-dev.js when I switch from one view to another:

[Ext.Loader] Synchronously loading 'Ext.layout.container.Absolute'; consider adding Ext.require('Ext.layout.container.Absolute') above Ext.onReady

XMLHttpRequest cannot load file:///C:/Users/alejandro.vasquez/Desktop/itsPublish/ext/src/layout/container/Absolute.js?_dc=1402603641026. Cross origin requests are only supported for HTTP.

Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: 'file:///C:/Users/alejandro.vasquez/Desktop/itsPublish/ext/src/layout/container/Absolute.js'; It's likely that the file is either being loaded from a different domain or from the local file system whereby cross origin requests are not allowed due to security reasons. Use asynchronous loading with Ext.require instead.

and I don't fully understand it, can someone please explain to me what is causing the error exactly and more importantly, how I can fix it? Is this just because I'm trying to load it locally? but other projects load just fine. and it says to add Ext.Require above Ext.onReady, but I don't see Ext.onReady used anywhere, where would that be? Please any help would be greatly appreciated, I urgently need to find a fix for this.

Gary Schlosberg
13 Jun 2014, 3:25 PM
I believe the issue is this part of the error message:
"or from the local file system whereby cross origin requests are not allowed due to security reasons."

The paths you are referencing seem to be local, which is causing problems. Change the paths to http:// using your web server (local or otherwise) and it should go away.

alejandroNNU
14 Jun 2014, 10:46 AM
Hi Gary,thank you for the response, I realize that loading the project from the local file system seems to be an issue because of the part of the error you just quoted, however, it's only a problem because it's trying to fetch the file Absolute.js through XMLHttpRequest, which makes no sense, why is it doing that? Absolute.js is a local file, I'm looking at it right here in the ext/src/layout/container directory, why is it trying to load it via XHR as it states? I have several other projects that load just fine in the local file system, and you are correct btw, if I load this on my webserver (localhost), it does load, but I still get the warning, which means something is still off:

[Ext.Loader] Synchronously loading 'Ext.layout.container.Absolute'; consider adding Ext.require('Ext.layout.container.Absolute') above Ext.onReady

but I don't see any instances of Ext.onReady, where am I supposed to add this?