Open ilinkuo opened 11 years ago
It turns out not only is the :error
handler not called, the :complete
handler is also not called, so my implementation suggestion above will not work.
My temporary local hack to this problem was to create an associated setTimeout
which called the removeApp()
and place the corresponding clearTimeout
in the complete handler. The value of the timeout was set at an arbitrary 6000ms.
Looks like passing a timeout
parameter into $.ajax will allow jQuery to call the appropriate handlers. http://jsfiddle.net/rekabnairb/EJJbv/
That timeout seems good to me.... I've found that it is a little tricky and haven't quite figured out how to do this. The problem is that even if the timeout causes the error handler to be thrown and then the app is removed, if the request comes back after the timeout, the code in the request will still run. There has to be a way to prevent the slow-loading code from running at all.
I found this problem in 1.1.2 and checked that the handling was still the same in 1.2.
When the manifest fails to load, the app is not removed
Root cause: Lines 16523-16528 of https://github.com/OpenF2/F2/blob/master/sdk/f2.debug.js are not invoked
This is a limitation of jQuery's ajax handler. See http://api.jquery.com/jQuery.ajax/
Please make the behavior the same for all requests, regardless of domain.
Implementation suggestion: Put the removal check in the :complete handler and have the success set a flag to be checked.