less than 1 minute read

Symptom

There’s a service that uses pdf.js, and the PDF viewer intermittently(!) throws this error. It only happens on Google Chrome.

net::ERR_CACHE_OPERATION_NOT_SUPPORTED

ERR_CACHE_OPERATION_NOT_SUPPORTED

Environment

  • Web Browser: Chrome 67
  • pdf.js: v1.9.426(stable)

Cause

When pdf.js downloads a PDF file, the worker sends a Range request. This is presumably because Google Chrome hasn’t handled this properly since version 61.

Fix

You just need to avoid sending the Range request. Add the following script to pdfjs/web/view.html.

<script>
  PDFJS.disableWorker = true;
  PDFJS.disableRange = true;
</script>

I trust it’ll work fine now. Done!

References

https://github.com/mozilla/pdf.js/issues/9022

Leave a comment