Firefox timeout giving empty response from POST AJAX request from Datatables
Firefox timeout giving empty response from POST AJAX request from Datatables

Firefox's network.http.network-changed.timeout has a default value of 5s. If the POST request from AJAX of DataTables is slow to respond Firefox timeout's and shows "No response data available for this request"
Expected results:
Current version of Chrome and older versions of Firefox do not have this issue. They obtain a response and update the table data in the browser as expected.
How can DataTables and newer version of Firefox be made compatible? Are there options to be set in AJAX of DataTables to reduce the occurrence of timeout's from Firefox?
Cross-listing issue from Firefox Bugzilla here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1602154
This question has an accepted answers - jump to answer
Answers
You should be able to use:
Our
ajax
option is basically just a proxy tojQuery.ajax
so the above will use the jQuery Ajaxtimeout
option, which sets the timeout for the created XMLHttpRequest, which in turn should override the Firefox default.Allan
This sounds correct, but according to https://bugzilla.mozilla.org/show_bug.cgi?id=1602154
it seems like Firefox may be simply ignoring this value.
Do you know if DataTables can specifically override the network.http.network-changed.timeout preference in Firefox or would there be any other way to allow Ajax response >5s in Firefox?
See also https://stackoverflow.com/questions/24526201/ajax-does-setting-timeout-always-override-the-browsers-timeout on behavior of browsers that may be ignoring the timeout value sent with the Ajax request.
I don't believe that is a setting that can be set by Javascript?
The SO post is interesting, but it is talking in terms of minutes rather than seconds. The Bugzilla thread is perhaps more interesting. It seems to note that Firefox will always kill a connection after 5 seconds of in activity.
To my mind, the way to address that would be to make your server periodically flush data to the client - say once per second. Are you currently loading the entire data set into memory and then echoing it out?
Another option would be to consider using server-side processing which should easily respond within a second (depending on the data and server of course).
Allan