Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronous AJAX requests are deprecated warning #364

Open
kenny1983 opened this issue Oct 17, 2016 · 9 comments
Open

Synchronous AJAX requests are deprecated warning #364

kenny1983 opened this issue Oct 17, 2016 · 9 comments

Comments

@kenny1983
Copy link

When refreshing a page via a top-level document.write(), I get the following warning in Chrome Developer Tools:

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

So I was simply wondering where and why synchronous AJAX requests are used within pace. As the warning suggests, this is generally considered bad behaviour, and I suggest that you guys find a workaround ASAP.

@SilverSlug
Copy link

I am having the same problem. I believe that it has to do with the XMLHttpRequest.open(). As noted here https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open, shows that...

Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), synchronous requests on the main thread have been deprecated due to the negative effects to the user experience.

In pace.js I have tried to add the parameter on line 428
_this.trigger('request', {
type: type,
url: url,
request: req,
async: true
});

and on line 434
return _open.apply(req, arguments, true);

But have had no luck. Anyone have any other ideas?

@kmeado
Copy link

kmeado commented Oct 19, 2016

also having this issue.

@john20xdoe
Copy link

also still has a same open issue #199.

@sujitswaroop
Copy link

Check if your AJAX call is set to false (async: false), if not then the chances are that you have some extensions running on your browser that do a synchronous call back. Easy way to identify is to open the console in Chrome, enable "Log XMLHttpRequests" and you will be able to see the extension that is causing the issue to be reported. Hope this helps.

@matissg
Copy link

matissg commented Aug 16, 2017

@sujitswaroop Changed from Pace JS 1.0.0. to 0.7.8. version, however I don't see any difference. In fact my Crome console is pointing now to the line return _open.call(req, type, url, async);

In both case I get similar warning:
[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/.

Is there any permanent solution for this, please?

@dyardyGIT
Copy link

I just tried 1.0.2 and have this issue as well

@hlawuleka
Copy link

For me this was happening in the context of doing AJAX(XMLHttpRequest) calls in a Chrome extension js file and I was able to fix the issue with passing true as third parameter when I did:

xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", endPoint, true);

@atedin
Copy link

atedin commented Dec 10, 2018

In the error message you will find the document of the "XMLHttpRequest"

At the 1/6 of the page (scroll down) you will find this:

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 current global object is a Window object. User agents are strongly encouraged to warn about such usage in developer tools and may experiment with throwing an "InvalidAccessError" DOMException when it occurs.

long way, but you better use to use Service Workers

https://developers.google.com/web/fundamentals/primers/service-workers/

@Sseriously
Copy link

Thanks Hlawuleka I had Async set to FALSE for some reason....

xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", endPoint, false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants