Synchronous XMLHttpRequest warning and [removed]

前端 未结 7 1934
猫巷女王i
猫巷女王i 2020-11-27 16:56

I\'m getting a warning message:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user\'s expe

7条回答
  •  一生所求
    2020-11-27 17:30

    UPDATE: This has been fixed in jQuery 3.x. If you have no possibility to upgrade to any version above 3.0, you could use following snippet BUT be aware that now you will lose sync behaviour of script loading in the targeted content.

    You could fix it, setting explicitly async option of xhr request to true:

    $.ajaxPrefilter(function( options, original_Options, jqXHR ) {
        options.async = true;
    });
    

提交回复
热议问题