您当前的位置: 首页 >  http

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ajax方法执行同步的黄色警告:Synchronous XMLHttpRequest on the main thread is deprecated的解决方案

漏刻有时 发布时间:2020-08-05 17:53:32 ,浏览量:0

在这里插入图片描述

[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/.

翻译:在主线程同步XMLHttpRequest是不赞成的,因为对最终用户的体验有不利影响。更多帮助,检查HTTP:/ / XHR。spec.whatwg。org /

以上警告信息在ajax方法执行同步操作(等有了返回值才执行下面的js,会短暂阻断程序继续执行)的时候出现,即:async:false。同步执行AJAX不影响程序的正常执行。当然,如果业务层面允许,推荐异步执行AJAX,即将async属性设置为true。(当然,ajax()方法async缺省下为true)

Done!

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0599s