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

quarto.js blocked by Cross origin requests policy when not previewing using web server #11904

Open
cderv opened this issue Jan 20, 2025 · 2 comments
Labels
documentation Doc improvements & quarto-web html Issues with HTML and related web technology (html/css/scss)
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jan 20, 2025

With the new way quarto.js works, and how in import tabset.js, Quarto will show console error about loading scripts when opening the HTML file, without having resource embeded.

Access to script at '(...)/index_files/libs/quarto-html/quarto.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: chrome, chrome-extension, chrome-untrusted, data, http, https, isolated-app.

Image

This happens with Quarto 1.6.40 too.

quarto.js:1 Uncaught SyntaxError: Cannot use import statement outside a module

Image

I am opening this issue in case anyone else is searching for this, as this is new starting from Quarto 1.6. Previously, opening from file system would work, but now, Quarto documents needs to be served (using quarto preview for example) so that they fully works. This was previously required only when using some JS tool that required server (like OJS)

I don't known if we can improve this somehow, but at least this should be documented somewhere... maybe in the FAQ. 🤔
This can be surprising to some users.

(I found this while looking at rich-iannone/DiagrammeR#519 (comment) where quarto preview does not work with some JS lib and opening from file system help)

@cderv cderv added documentation Doc improvements & quarto-web html Issues with HTML and related web technology (html/css/scss) labels Jan 20, 2025
@cderv cderv added this to the Future milestone Jan 20, 2025
@cscheid
Copy link
Collaborator

cscheid commented Jan 20, 2025

The only instance of this class of issues that we should fix is if it appears in the output of our email format. Anywhere else, we should not be trying to do it. It's not necessary (we have quarto preview on windows, and on Unix there's about 30 different ways of conveniently starting a local HTTP server). These restrictions exist for good reasons, and we should be slowly discouraging people from using file:// anyway.

@cderv
Copy link
Collaborator Author

cderv commented Jan 20, 2025

These restrictions exist for good reasons, and we should be slowly discouraging people from using file:// anyway.

To be clear, I totally agree on this.

I feel this could raise question among prior R Markdown users used to open their file on disk. So I want to think on where to make that clear in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Doc improvements & quarto-web html Issues with HTML and related web technology (html/css/scss)
Projects
None yet
Development

No branches or pull requests

2 participants