I've read a bunch of questions and answers about this, including this one JavaScript console.log causes error: "Synchronous XMLHttpRequest on the main thread is deprecated..." which has a number of very different answers that give different specific causes. But I haven't found anything to explain why I'm seeing it for my case, which is as follows:
I went to this page for an example of implementing an upload progress bar, and downloaded the demo which is a small .zip file containing only 3 files which I put in my web root:
- index.php
- upload.php
- LoaderIcon.gif
The demo seemed to work okay as-is (except it displays the form a second time after submit). But it gets jQuery from the cdn, while I've always hosted the javascript I use on our own site.
So I downloaded https://code.jquery.com/jquery-2.1.1.min.js to the /js
directory below my web root, and changed the script tag in the index.php
file to read src="/js/jquery-2.1.1.js"
instead of src="https://code.jquery.com/jquery-2.1.1.min.js"
. Absolutely no other changes.
This single change triggers the XMLHTTPRequest warning. Some of the answers I've seen note that an ajax request inserting a <script>
tag into the html for a page will trigger the warning, but that's definitely not happening here. I tried changing src="/js/jquery-2.1.1.js"
to src="http://localhost/js/jquery-2.1.1.js"
but that did not help. The only ways I found to get rid of the warning (other than trying to suppress it) were to load jquery from a different domain, or copy-paste the content of jquery-2.1.1.js
between <script>
tags in index.php.
Can anyone explain why this happens, and suggest a way to avoid the problem while still hosting the script on my own site?