Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load worker script via XHR and init global scope at the right time #4

Merged
merged 1 commit into from
Jul 15, 2016

Conversation

moesjarraf
Copy link
Member

@moesjarraf moesjarraf commented Jul 15, 2016

PDFJS doesn't work in firefox (as of v45 and higher). This is because firefox does not allow workers to be instantiated based on scripts that are on a different origin. I bypassed this by first loading the worker script through XHR (this requires the worker script to be sent with the header Access-Control-Allow-Origin). I also changed the timing that the globalScope is populated (so configuration in angular-pdfjs can be done). It now happens right before the PDFJS.webViewerLoad function is called, instead of automatically.

Some relevant links.
http://colonelpanic.net/2014/08/using-pdf-js-web-worker-cross-domain-cors/
https://www.fxsitecompat.com/en-CA/docs/2016/loading-cross-origin-worker-now-fires-error-event-instead-of-throwing-worker-in-sandboxed-iframe-no-longer-allowed/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants