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/
and points to the following part of code...
try { xhr.open('GET', noCacheUrl, false); xhr.send(null); } catch (e) { isCrossOriginRestricted = true; }
can you guys tell me how to prevent it from happening...
providing my code below in that file
/** * Load a script file, supports both asynchronous and synchronous approaches * @private */ loadScriptFile: function(url, onLoad, onError, scope, synchronous) { if (isFileLoaded[url]) { return Loader; }
var config = Loader.getConfig(), noCacheUrl = url + (config.disableCaching ? ('?' + config.disableCachingParam + '=' + Ext.Date.now()) : ''), isCrossOriginRestricted = false, xhr, status, onScriptError, debugSourceURL = ""; scope = scope || Loader; Loader.isLoading = true; if (!synchronous) { onScriptError = function() { }; scriptElements[url] = Loader.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope); } else { if (typeof XMLHttpRequest != 'undefined') { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject('Microsoft.XMLHTTP'); } try { xhr.open('GET', noCacheUrl, false); xhr.send(null); } catch (e) { isCrossOriginRestricted = true; } status = (xhr.status === 1223) ? 204 : (xhr.status === 0 && (self.location || {}).protocol == 'file:') ? 200 : xhr.status; isCrossOriginRestricted = isCrossOriginRestricted || (status === 0); if (isCrossOriginRestricted ) { } else if ((status >= 200 && status < 300) || (status === 304) ) { // Debugger friendly, file names are still shown even though they're eval'ed code // Breakpoints work on both Firebug and Chrome's Web Inspector if (!Ext.isIE) { debugSourceURL = "\\n//@ sourceURL=" + url; } Ext.globalEval(xhr.responseText + debugSourceURL); onLoad.call(scope); } else { } // Prevent potential IE memory leak xhr = null; } },
This warning is only showing in Chrome in the development environment of ExtJs. Once the application is built with sencha cmd
, the warning doesn't show anymore. As @Evan pointed out the warning looks benign, and you should not have to worry about it.
The fact that there is a warning should not be an issue, since it will never show in a deployed application. If you do not yet use sencha cmd, it is definitely worth to integrate it in your development cycle.
I know it is not a direct answer to the question. Myself, I wonder if it is possible to get rid of this warning at all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.