JavaScript console.log causes error: “Synchronous XMLHttpRequest on the main thread is deprecated…”

后端 未结 21 1747
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 09:26

I have been adding logs to the console to check the status of different variables without using the Firefox debugger.

However, in many places in which I add a

相关标签:
21条回答
  • 2020-11-22 09:28

    Visual Studio 2015/2017's live debugger is injecting code that contains the deprecated call.

    0 讨论(0)
  • 2020-11-22 09:28
    1. In Chrome, press F12
    2. Develomping tools-> press F1.
    3. See settings->general->Apperance: "Don't show chrome Data Saver warning"- set this checkbox.
    4. See settings->general->Console: "Log XMLHTTPRequest" - set this checkbox too.

    Enjoy

    0 讨论(0)
  • 2020-11-22 09:29

    To avoid this warning, do not use:

    async: false
    

    in any of your $.ajax() calls. This is the only feature of XMLHttpRequest that's deprecated.

    The default is

    async: true
    

    jQuery has deprecated synchronous XMLHTTPRequest

    0 讨论(0)
  • 2020-11-22 09:29

    And I got this exception for including one can.js script inside another, e.g.,

    {{>anotherScript}}
    
    0 讨论(0)
  • 2020-11-22 09:31

    I got this exception when I set url in query like "example.com/files/text.txt". Ive changed url to "http://example.com/files/text.txt" and this exception dissapeared.

    0 讨论(0)
  • 2020-11-22 09:32

    I have been looking at the answers all impressive. I think He should provide the code that is giving him a problem. Given the example below, If you have a script to link to jquery in page.php then you get that notice.

    $().ready(function () {
        $.ajax({url: "page.php",
            type: 'GET',
            success: function (result) {
            $("#page").html(result);
       }});
     });
    
    0 讨论(0)
提交回复
热议问题