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

documentViewer broken with extrenal URLs after 6.1 #464

Closed
ybendek opened this issue Jun 19, 2017 · 7 comments
Closed

documentViewer broken with extrenal URLs after 6.1 #464

ybendek opened this issue Jun 19, 2017 · 7 comments
Assignees
Milestone

Comments

@ybendek
Copy link

ybendek commented Jun 19, 2017

Hello Guys

I have been using this component without problems until I upgrade to 6.1.1, now when I'm including an external URL an exception is displayed in console and the file is not displayed

VM1172 pdf.viewer.js.jsf?ln=primefaces-extensions&v=6.1.1:20481 Uncaught (in promise) Error: file origin does not match viewer's
at validateFileURL (VM1172 pdf.viewer.js.jsf?ln=primefaces-extensions&v=6.1.1:20481)
at webViewerInitialized (VM1172 pdf.viewer.js.jsf?ln=primefaces-extensions&v=6.1.1:20500)
at

I found that now is required that the URL should be in the same server, apparently you could edit the variable HOSTED_VIEWER_ORIGINS to include the url as is mention in this forum (mozilla/pdf.js#7153) but unfortunatelly with Primefaces-extension I dont have an option, and changing manually that file inside of the jar is an option I dont want to apply

@melloware melloware self-assigned this Jun 19, 2017
@melloware melloware added this to the 6.2.0 milestone Jun 19, 2017
@melloware
Copy link
Member

Can you try something. Just somewhere in your own JS code that loads AFTER the PFE code can you add this line...

var HOSTED_VIEWER_ORIGINS = ['null',  'http://mozilla.github.io'];

Where the URL is the root URL of the PDF you are trying to load?

@ybendek
Copy link
Author

ybendek commented Jun 20, 2017

Nothing, the same exception, I try even debugging the pdf.viewer.js and this code overrides the variable I'm defining in my code, I'm including this code at the end of the file.

@melloware
Copy link
Member

OK I ripped out that check and updated my notes for any future upgrade to remove this JS. You can try this 6.1.1-SNAPSHOT I built for your. Grab the latest one in the DIR from today.

https://oss.sonatype.org/content/repositories/snapshots/org/primefaces/extensions/primefaces-extensions/6.1.1-SNAPSHOT/

@ybendek
Copy link
Author

ybendek commented Jun 20, 2017

Thank you.

How could I include that in my project? I'm using maven, and I'm including primefaces extensions with a dependency:

      <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>6.1.1</version>
            <type>jar</type>
        </dependency>

@jxmai
Copy link
Member

jxmai commented Jun 20, 2017

Don't think snapshot is hosted in maven, so I guess you need to include a local jar file with some setup in pom.xml.


Here is the stackoverflow link that might be helpful to you

image

@melloware
Copy link
Member

@ybendek
Copy link
Author

ybendek commented Jun 20, 2017

thank you

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

No branches or pull requests

3 participants