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

SecurityError: Permission denied to access property "print" on cross-origin object #9614

Closed
ghostman-git opened this issue Mar 30, 2018 · 5 comments

Comments

@ghostman-git
Copy link

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: firefox 59.0.2 (64 位)
  • Operating system and its version: windows 10 x64
  • PDF.js version:
  • Is a browser extension:

Steps to reproduce the problem:

  1. SecurityError: Permission denied to access property "print" on cross-origin object

What is the expected behavior? (add screenshot)

What went wrong? (add screenshot)

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

@timvandermeij
Copy link
Contributor

timvandermeij commented Mar 30, 2018

Closing since this looks like a duplicate of #5397, which has more debugging information.

@ghostman-git
Copy link
Author

So far, no solution has been proposed

@vaspervnp
Copy link

The problem is the viewer. The embedded viewer causes the cross-origin problem. Try creating your own viewer. That will solve the problem. e.g. from here: https://pspdfkit.com/blog/2019/implement-pdf-viewer-pdf-js/

Or if you need a full featured viewer, you can use the Mozilla one from here: http://mozilla.github.io/pdf.js/web/viewer.html (for this one you will need to download the latest pdf.js and pdf.worker.js implementation). I just did that for a project at work, and it works like a charm.

@worthy7
Copy link

worthy7 commented Sep 27, 2019

@vaspervnp Why does the embedded viewer cause the problem? What part of the viewer is making the window think that it's url is on a different domain?

@vaspervnp
Copy link

vaspervnp commented Oct 11, 2019

@worthy7 It loads the viewer from a local resource namespace. The browser thinks that is a different domain, because it actually is.

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

No branches or pull requests

4 participants