ExtJS 4.2 - Possible causes of a “Sychronous XMLHttpRequest” warning?

不问归期 提交于 2019-12-18 09:25:37

问题


Good day, sorry for the seemingly broad question title.

I am building an ExtJS4 application using php and sql for the user data. Everything was going fine until one day, I notice this error in my java console:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. 
For more help, check http://xhr.spec.whatwg.org/.

Initially, I wasn't that troubled since my application was loading fairly well while testing it in my local network. However, once I uploaded to an online server and tested it, the application loaded really slowly and sometimes it wouldn't load at all.

I don't recall calling an XMLHttpRequest anywhere in my application, so I'm dumbfounded on how or why I'm getting this warning all of a sudden.

The only way I connect to my database and back is via Stores.

Also, as a side question, is there a way to make ExtJS4 applications load faster? I've minimized the size of the images/icons I use and I think the issue lies with the stores but none of my stores are set on autoload.

Any help is very much appreciated. Thank you.


回答1:


I had this error a while a ago. It is caused by Ext.Loader which loads the Ext classes dynamically.

I could solve it by adding the required classes in the Ext.require([...]) statement in the main js file of my application (i.e. app.js).

The docs for Ext.Loader explain when and why asynchronous and synchronous loading happens.




回答2:


Not sure about the main question, never seen that before with extjs 4 apps I have written.

For the question in loading the application faster you should be using sencha CMD to produce a concatenated and minified version of your source for using in a production environment.

Edit

I just came across this SO - "Synchronous XMLHttpRequest on the main thread is deprecated" using nodejs app.get or http-server

Talks about the same issue but with a different framework and comments suggests its an error on client side. Have you changed much lately with how your are fetching data from the server?



来源:https://stackoverflow.com/questions/28524757/extjs-4-2-possible-causes-of-a-sychronous-xmlhttprequest-warning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!