Using the following code:
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
Yields the following error:
Uncaught InvalidAccessError: Failed to execute 'open' on 'XMLHttpRequest': Synchronous requests are disabled for this page.
Is it simply not possible, or am I doing it wrong? Do I need extra permissions?
Using the following code:
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
Yields the following error:
Uncaught InvalidAccessError: Failed to execute 'open' on 'XMLHttpRequest': Synchronous requests are disabled for this page.
Is it simply not possible, or am I doing it wrong? Do I need extra permissions?
Share Improve this question asked Dec 29, 2014 at 18:05 sollnisssollniss 2,0032 gold badges22 silver badges38 bronze badges 3- 2 Why would you ever want to do that ? – adeneo Commented Dec 29, 2014 at 18:07
- 1 @adeneo could be useful within a web-worker, where there is no concern of blocking the UI thread – levi Commented Dec 29, 2014 at 18:16
- PDFJS uses it in the viewer. – sollniss Commented Dec 29, 2014 at 18:23
1 Answer
Reset to default 5Synchronous XMLHttpRequests
are disabled by default for Chrome apps.
Check this link to see all disabled web features and the workarounds. For this case:
Use async-only XMLHttpRequest: Getting Rid of Synchrounous XXRs.