- 我工作的ExtJS的框架..
- 我對ExtJS的運行的應用程序..
- 每當我打開瀏覽器應用程序...我看到以下 警告我的控制檯...
在主線程同步的XMLHttpRequest是因爲它的不利影響已棄用s到最終用戶的體驗。如需更多幫助,請http://xhr.spec.whatwg.org/在主線程同步的XMLHttpRequest已被棄用
- 你們可以告訴我怎麼刪除..
- 當我點擊它需要EXT-所有調試-W-comments.js文件警告
並指向以下部分代碼...
嘗試xhr.open('GET',noCacheUrl,false); xhr.send(null); (e){ isCrossOriginRestricted = true; }
你們可以告訴我如何防止它發生......
提供下面我的代碼在該文件中
/** * 加載腳本文件,支持異步和同步方法 * @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; } },
'xhr.open('GET',noCacheUrl,false);'刪除'false'。但是,你必須將'try-catch'語句下的所有內容移動到像這樣的'xhr.addEventListener('load',function(){'... code ...'})''的事件處理程序中。 – Xufox
@xufox它令人困惑,你可以在下面的代碼中更新代碼https://jsfiddle.net/e1hfjue1/ –
它只發生在你使用動態加載時。這不是一個真正的問題。 –