[Solved-3 Solutions] “Synchronous XMLHttpRequest on the main thread is deprecated…”



Error Description:

  • In many places when we add a console.log in my main.js file, we receive the following error:
  • Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

Solution 1:

    • The warning message MAY BE due to an XMLHttpRequest request within the main thread with the async flag set to false.

    Solution 2:

      • Use Chrome Browser > Hit F12 to bring DevTools
      • Open the drawer menu (in Chrome 3 vertical dots in the upper right)
      • Under Console > check Log XMLHttpRequests option
      • Reload your page that was giving you the error and observe what happens on each ajax request in the console log.

      Solution 3:

        • To avoid this warning, do not use:
        async: false
        
        click below button to copy the code. By - jquery tutorial - team
        • in any of your $.ajax() calls. This is the only feature of XMLHttpRequest that's deprecated.
        • The default is
        async: true
        
        click below button to copy the code. By - jquery tutorial - team

        Related Searches to “Synchronous XMLHttpRequest on the main thread is deprecated…”