Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronous XMLHttpRequest on the main thread is deprecated

Why has this message suddenly started to appear in the Firefox console?

I'm using JQuery 1.7.1.

What in my app could I be doing that has caused this message to start appearing?

like image 240
1DMF Avatar asked Jul 14 '14 16:07

1DMF


People also ask

How do I fix synchronous XMLHttpRequest on the main thread is deprecated?

The solution to the above problem is to set async setting of the jQuery AJAX function to true as AJAX itself means Asynchronous JavaScript and XML and hence if you make it Synchronous by setting async setting to false, it will no longer be an AJAX call.

Is XHR deprecated?

Synchronous XHR is now in deprecation state. The recommendation is that developers move away from the synchronous API and instead use asynchronous requests.

Is Ajax deprecated?

ajax() is deprecated.


1 Answers

Using jQuery to append a script tag to the document will cause it to load the script with async:false and trigger this warning.

As in:

var script = $("<script></script>"); script.attr("src", player.basepath + "whatever.js"); $(document.body).append(script); 
like image 155
Jason Kester Avatar answered Sep 22 '22 22:09

Jason Kester