:동기 XMLHttpRequest의 경고와 내가 경고 메시지를 받고 있어요 <script>
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/ .
$.html()
방법을 사용하여, HTML에 주입하는 스크립트를 (즉, 지역 src
있다)가 포함 된 비동기 AJAX 요청을 수행. 주어진 스크립트가 async="async"
을 포함하도록 변경했지만 경고 메시지가 여전히 남아 있습니다.
내가 (문제가 어디에서 오는지 그 아마) 내 async
이 false
로 설정되어 jQuery.ajaxTransport
(http://code.jquery.com/jquery-1.10.0.js, # 8663)에서 JQuery와 AJAX 호출을 통해 처리됩니다 <script>
을 추가 발견하기 위해 문제를 디버깅 시작했습니다.
이제 어떻게해야합니까?
메시지는 Firefox뿐만 아니라 최신 버전의 Chrome에도 나타납니다. 내가 jsfiddle에 테스트 케이스를 제공 할 수는 없지만
, 여기에 문제를 표시하는 테스트 케이스의 :
인 test.html를
<html>
<body>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script>
$(document).ready(function(){
$.ajax({
url: '/response.html',
success: function(response){
$(document.body).html(response);
}
})
});
</script>
</body>
</html>
response.html
<script type="text/javascript" src="/json.js" async="async"></script>
json.js
console.log('hi');
AJAX 요청이 경고를 트리거 할 필요가 없습니다 - 모든 <script>
test2.html
<html>
<body>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script>
$(document).ready(function(){
$(document.body).html('<script type="text/javascript" src="/json.js" async="async"><\/script>');
});
</script>
</body>
</html>
그것은이 고정 된 것을 주목할 필요가 삽입되어 필요하다, https://github.com/jquery/jquery/issues/2060
일부 유사 [질문] (http://stackoverflow.com/q/27736186/4043409). – Gideon
안녕하세요, 크롬 및 파이어 폭스의 whatsapp 버전에서이 사실을 알 수 있습니까? – Raj