0

I am working on a project with chrome extension V3.
I want to show a progress bar when users upload files.

What I am struggling here is that Fetch API does not seem to support something like 'xhr' in ajax.
With the chrome extension V2, I was able to do the following.

$.ajax({
   .....
   xhr: () => {
      const myXhr = $.ajaxSettings.xhr();
      myXhr.upload.addEventListener(
         'progress',
         myHandleEvent,
         false
      );
   }
   .....
});

Since ajax is no longer available with chrome V3, I need to find a way to do the same with Fetch API.

I did some researches by myself with the following pages.

My conclusion so far is that Streaming support for upload is not ready yet.
Did I make a correct conclusion?
Do I just have to wait until it is available?
Or does anybody have any workaround?
Lastly, am I missing anything here?

L.J.
  • 1
  • 1

1 Answers1

0

Ajax is supported by service worker sin Ajax is the technology, but JQuery $.ajax method under the hook uses XMLHttpRequest which is not supported by Service Worker on manifest V3 extension, for manifest V2 extensions XMLHttpRequest was supported because there is not Service Worker, it's just another web context that is acting as a background page.

So to answer the question, so far there is not support for tracking the progress for uploading stuff via fetch, sadly.

Juorder Gonzalez
  • 1,642
  • 1
  • 8
  • 10