Toolbook sends synchronous XMLHttpRequest

Workarounds and usability notes.

Toolbook sends synchronous XMLHttpRequest

Postby John Robin Dove » Fri Mar 29, 2024 5:51 am

Hi Clifton,

I hope you are well.

I have been trying to eliminate some of the warnings I see in the console. I was particularly concerned about a deprecation warning concerning my recording system. I was using the ScriptProcessorNode. Apparently, deprecated functions may become unavailable without prior notice. I was worried that sooner or later the recording system would cease to function. Fortunately, after many weeks of trial and error, I have managed to upgrade to the AudioWorkletNode, thanks to some very fine code examples generously made available on the internet. So that has been taken care of and I am in the process of updating my main program now.

I still see this: L’utilisation d’XMLHttpRequest de façon synchrone sur le fil d’exécution principal est obsolète à cause de son impact négatif sur la navigation de l’utilisateur final. Consulter https://xhr.spec.whatwg.org/#sync-warning pour plus d’informations classes.js line 1 > eval:36:14. Apparently Toolbook uses synchronous XMLHttpRequests. Do you think that one day this might also be a problem or should we not worry about it?

Thanks for your time.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Toolbook sends synchronous XMLHttpRequest

Postby Clifton » Fri Mar 29, 2024 7:45 am

Truthfully, I wouldn't worry about this. There will always be situations where synchronous XMLHTTP requests will need to be made. Even in shopping carts, and other web-related tasks. When you see the warning in the Firefox console, it is noting that your ToolBook export has the synchronous code in it, not that it is necessarily being employed. Even if you eliminate all instances of synchronous requests, this warning may still exist because ToolBook exports include it in classes.js whether it is actually used in the export or not.

Even with the XML page loading system that I'm using, most of the time asynch works, but occasionally in may work it is necessary to go synchronous to avoid an error situation. That is just the way some web content is. The depreciation warning is basically (IMO) just telling developers to use it as little as possible to keep the user experience at a premium. However, if they ever remove the synchrous ability altogether will cause a lot of web content to no longer run correctly.

I could be wrong in this assessment, but the depreciation warning has been around for a long time. The only place where it gave a real hiccup is in Chrome if used in connection to an LMS. On exit, Chrome would close its window, thus breaking the connection to the LMS before posting results, which needed to be made synchronously. I patched the internal ToolBook code to make it asynch so it successfully posts before the window.close message is posted. I had a client who stumbled across this as their students were losing their LMS results and completion status. Firefox was never at issue and Google received many complaints to put the previous behavior back. Rather than wait for Google, I changed how ToolBook content behaves.

Chrome still allows synchronous communication as of today and I think the browser manufacturers just put the warning in place to make developers aware of the need to use it sparingly. If asynch will works, then use it, is their recommendation.

Clifton
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Toolbook sends synchronous XMLHttpRequest

Postby John Robin Dove » Fri Mar 29, 2024 9:57 am

Many thanks.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

cron