Skip to content

pdfviewer will not show online pdfs... even with CORS correctly configured #7399

@leinaD-natipaC

Description

@leinaD-natipaC

Link to PDF file (or attach file here): https://github.com/mozilla/pdf.js/blob/gh-pages/web/viewer.js#L8366

Configuration:

  • Web browser and its version: firefox
  • Operating system and its version: ubuntu
  • PDF.js version: PDF.js version 1.5.292 (latest commit of gh-pages as of today- bc5e00a)
  • Is an extension: no

Steps to reproduce the problem:

  1. Set up a page for the viewer.
  2. Set up a server to serve pdfs with the access-control-allow-origin configured correctly
  3. Go to the viewer with the file argument set to one of the pdfs from step 2 (as in "example.com/web/viewer.html?file=http://website.org/pdf.pdf")

What is the expected behavior? (add screenshot)
For the viewer to show the pdf normally.

What went wrong? (add screenshot)
Exception thrown by the viewer: "file origin does not match viewer's"

NOTICE: When I removed the throw exception from line 8366 (if (fileOrigin !== viewerOrigin) then throw the exception), the viewer worked JUST FINE with my project. So this check should be substituted for one that doesn't prevent something that should work from working, or removed (IMO).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions