admin管理员组文章数量:1430127
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.
本文标签: javascriptHow to do a synchronous XMLHttpRequest in Chrome AppStack Overflow
版权声明:本文标题:javascript - How to do a synchronous XMLHttpRequest in Chrome App? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745536325a2662288.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论