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

Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame. #6

Open
juanetec opened this issue Feb 14, 2021 · 2 comments

Comments

@juanetec
Copy link

Hi,
checking this plugin is giving me that Error using this piece a code:
var _url ="http://localhost:8080/uploads/etec.pdf" plugins.printjs.print(_url,'pdf');

In the servoy console shows:
ERROR org.sablo.BrowserConsole - B34E9AB:2|05D72402-845A-4B85-B44F-11D0F4073132|jramirez|Uncaught SecurityError: Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame. http://localhost:8080/printjs/PrintJS/lib/print.min.js:1:7141 SecurityError: Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame.

In the chrome DevTools shows:
print.min.js:1 Refused to frame 'blob:http://localhost:8080/c0659f82-9cf9-4e42-8fb2-73bd069414fd' because it violates the following Content Security Policy directive: "frame-src *".. Uncaught DOMException: Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame. at d (http://localhost:8080/printjs/PrintJS/lib/print.min.js:1:2207) at HTMLIFrameElement.o.onload (http://localhost:8080/printjs/PrintJS/lib/print.min.js:1:2015) Not allowed to load local resource: blob:http://localhost:8080/c0659f82-9cf9-4e42-8fb2-73bd069414fd

I put this url at the browser and work fine.
Please could you say me what I am doing wrong?

I am using servoy version 2020.12.1 -releaseNumber 3623
Thanks
Juan Ramírez

@sbutlerjr
Copy link
Contributor

You should use the example on the homepage, which is

//Store your docs to be printed in the location of plugins.file.getDefaultUploadLocation()
var file = plugins.file.convertToRemoteJSFile("/mydoc.pdf");
var url = plugins.file.getUrlForRemoteFile(file);
plugins.printjs.print(url,'pdf')

This avoids cross domain issues.

Also, please keep in mind this is is dual licensed and if your Servoy application isn't open sourced, you need to contact [email protected] for a license.

@juanetec
Copy link
Author

Hi Scott,
yes, this is what I am doing but is giving me the same error.
Could be a problem of a new Chrome version??

Un Saludo

Juan Ramírez

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

2 participants