chrome警告:Synchronous XMLHttpRequest on the main thread
- 警告

- 原因
ajax同步请求会触发此警告
- 分析
这段英文翻译:主线程上的同步XMLHttpRequest不受欢迎,因为它对最终用户的体验有害;
ajax同步,在向后台请求的过程中,前台代码执行会停留在ajax代码块中,直到请求成功才会执行ajax代码块之后的代码;
ajax异步,在向后台请求的过程中,在等待后台执行这个过程中,前台会继续 执行ajax块后面的代码,这是执行ajax代码块的是一个线程,执行ajax代码块后面代码的是另一个线程。
- 解决
ajax设置为异步即可,aysnc:true 默认为异步。
更详细解释可参考:https://blog.csdn.net/sky786905664/article/details/53079487
chrome警告:Synchronous XMLHttpRequest on the main thread的更多相关文章
- 关于chrome控制台警告:Synchronous XMLHttpRequest on the main thread
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to th ...
- Ajax.html:35 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org
AJAX的容易错误的地方 Ajax.html:35 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated ...
- Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental……
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to th ...
- jquery.js:8672 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
html5谷歌流浪器报错:jquery.js:8672 Synchronous XMLHttpRequest on the main thread is deprecated because of i ...
- Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more jquery-1.12.4.js:10208
ajax执行请求之后返回了数据但是不执行success()函数,原因是返回得数据类型不是ajax请求中设定的:dataType:"json",因为是一个Map<Object, ...
- iOS Main Thread Checker: UI API called on a background thread的解释
Xcode打印栏出现如下警告: Main Thread Checker: UI API called on a background thread 这个是什么错误呢? 其实这并不一定是错误,也可以理解 ...
- Why NSAttributedString import html must be on main thread?
The HTML importer should not be called from a background thread (that is, the options dictionary inc ...
- 13、主线程任务太多导致异常退出(The application may be doing too much work on its main thread)
今天花费了一天的时间来解决这个bug. 这种在程序运行期间出现的问题比较棘手,如果再没有规律的话就更难解决. 还好这个bug是由规律的,也就是说在程序执行半个小时左右后就会因为此异常而导致程序退出:那 ...
- reloadData should be in main thread
reloadData should be called in main thread, so if you call it in work thread, you should call it as ...
随机推荐
- typescript 起步之安装及配置 ts-node 环境变量
最近vue 3.0 版本发布,让我认识到 typescript 将占有越来越重要的地位,所以我也开启了typescript学习之旅. 要想编写第一个 hello typescript 程序,当然要经过 ...
- nginx 书籍
1.<实战nginx> 2.<深入理解nginx> 3.nginx开发从入门到精通 http://tengine.taobao.org/book/ 4.Nginx源码学习,配置 ...
- error C2664: “FILE *fopen(const char *,const char *)”: 无法将参数 1 从“LPCTSTR”转换为“const char *”
遇到这个问题,请打开本项目的Properties(属性)-------> Configuration Properties(配置属性)-------->General(常规)------- ...
- 「POJ3613」Cow Relays
「POJ3613」Cow Relays 传送门 就一个思想:\(N\) 遍 \(\text{Floyd}\) 求出经过 \(N\) 个点的最短路 看一眼数据范围,想到离散化+矩阵快速幂 代码: #in ...
- Django 学习 之路由层(URL)
路由层(URL) 1.路由层简单配置 (1)path方法 写固定的url. (2)re_path方法 可以正则规则 例: urlpatterns = [ path('admin/', admin.si ...
- 设计模式课程 设计模式精讲 2-2 UML类图讲解
1 类图讲解 1 类图讲解 + 公共方法 - private权限 # protected权限 包内和包外继承的子类都能引用 ~ default权限(包权限)只有包内能引用 下划线 静态 Stati ...
- VNC怎么和宿主机共享粘贴板
VNC怎么和宿主机共享粘贴板 假设目标主机是linux,终端主机是windows(就是在windows上使用VNC登陆linux) 在linux中执行vncconfig -nowin& 在li ...
- BUU re xor
从13行和18行的0x21(c规定十六进制必须用0x**表示)可以知道这个字符串就是33个字符 shift+e来提取出数组中的字符: 设这个数组是global数组 global[] = { 102, ...
- 更改windows系统的快捷键方法
众所周知,windows平台有很多快捷键使用非常的别扭. 现在提供windows 平台快捷键替换的绝佳软件:autohotkey 下载链接:http://ahkscript.org/ 中文帮助站点:h ...
- storm正常任务数据量过大时造成定时任务不执行的问题
在执行storm的定时任务时,发现storm普通任务数据量过大时造成定时任务不执行, 同时设置了storm的普通任务和定时任务,定时任务设置5秒执行1次. 普通任务的数据时从spout中不停发射字符串 ...