In the new browsers now there will be no more synchronous requests?

Asked

Viewed 3,430 times

22

I saw it today in mine Google Chrome, updated to the version 40.0.2214.91, a message that said

Synchronous Xmlhttprequest on the main thread is deprecated because of its detrimental effects to the end user’s Experience

translating:

Synchronous Xmlhttprequest in the main segment is discouraged by cause of its harmful effects on the end user experience

This means that for new browsers, requests via AJAX will no longer have the synchronous request.

I should already start changing the way of programming right now, thinking about future this directive be removed?

  • 2

    Excellent question +1

  • 5

    For years use synchronous requests has been advised against, even before the process of deprecation, simply by the negative effect on the user experience. I have seen this being insistently said in the English OS at least since 2012. Still, a lot of people still insist on using it. Nice attitude from the Chrome team to show a warning. And good attitude on your part to ask about it :)

1 answer

17


Yeah, that’s the idea. Look at specification:

Synchronous Xmlhttprequest Outside of Workers is in the process of being Removed from the web Platform as it has detrimental effects to the end user’s Experience. (This is a long process that takes Many years.) Developers must not pass false for the async argument when the Javascript global Environment is a Document Environment. User Agents are strongly encouraged to warn about such Usage in Developer tools and may experiment with Throwing an Invalidaccesserror Exception when it occurs.

What the browser is doing is following the above recommendation to warn that this is a resource that should not be used. Either use the asynchronous request or do this in a thread (worker).

Note that this will take so long that little done today will be alive there. Terrible things, far worse than this, that were allowed 20 years ago still work from today’s browsers.

Unfortunately, there are no more alerts. The vast majority of developers use things they shouldn’t use in bulk and don’t even know it. Not only in JS in browsers, this is true for many different languages and functionalities.

If something is considered obsolete, it should no longer be used in new things and whenever you have the opportunity to change something existing, it should be done.

Of course if you do not will not have problems for a long time, but there goes the posture of each professional and resources (time mainly to modify the existing, although it is something fast in this case) that each has.

But if you think about doing the synchronous request doesn’t make much sense. If you want to do this, call the page. Many people think that AJAX is a programming language. It’s just a very specific technique using XMLHTTPRequest and the A means asynchronous (Asynchronous Javascript And XML). Only no one uses XML anymore :)

  • 4

    I’m becoming a chronic commentator of yours :D "Tosynchronous Javascript tond XML" I was never curious to know what you meant...

  • Always welcome.

  • Today the acronym should be AJAJ (Tosynchronous Javascript Tond JSON) instead of AJAX (Tosynchronous Javascript Tond XML), since "no one uses XML anymore" for this purpose, where JSON is now used, almost as standard. =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.