Chrome extension: how to pass ArrayBuffer or Blob from content script to the background without losing its type?
问题 I have this content script that downloads some binary data using XHR, which is sent later to the background script: var self = this; var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.responseType = 'arraybuffer'; xhr.onload = function(e) { if (this.status == 200) { self.data = { data: xhr.response, contentType: xhr.getResponseHeader('Content-Type') }; } }; xhr.send(); ... later ... sendResponse({data: self.data}); After receiving this data in background script, I'd like to form