I'm trying to cache API call which is handled by XMLHttpRequest
with using Workbox. I successfully cached API calls in Cache Storage. However, the request to cached data fails when I switched to offline although the data is in Cache Storage. Then I replaced the method using XMLHttpRequest
with fetch event and it pulled the cached data and renders the element in offline.
So, I would like to know whether there is a workaround to use XMLHttpRequest
not fetch.
The reason I'm asking is that I am planning to cache API call for multiple many pages but most of the widgets in my workplace is using jQuery
Ajax. I'm afraid that we need to replace the method Ajax with fetch one-by-one.