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

Cannot open demo in <iframe> #394

Closed
levchak0910 opened this issue Feb 25, 2024 · 9 comments
Closed

Cannot open demo in <iframe> #394

levchak0910 opened this issue Feb 25, 2024 · 9 comments
Labels
status: needs clarification triage needs clarification from author

Comments

@levchak0910
Copy link

levchak0910 commented Feb 25, 2024

What steps are needed to reproduce the bug?

link with code:
https://stylelint.io/demo/#N4Igxg9gJgpiBcIA8AXGBbADgGwIZoD4AdAOyJQGcJ0ZSkB6NLPQ0uilAT2xmJNwAEwNigDmAJwCWUALRMc+GDNziYuCvBHkA5INzatKbQCMBp49oDcIyNnHwBACwp4AFACYADABoBARk8AUl8AZiDfAFZAgEprEgBfNn4hERkZADEICAc-VXQ4xLIihg5uXhBvEAAzSR4AOVwaBBAYAA9GnBgAOgA3AFc4SsgSGtFm4RIBASIW1rQSKAoZhwBtUimpmdKebEkSFBlh0ZkOXAWVKBnvdY2trh29g6PJURlVSHQaBZhZftoQG4AXVI8Qq4AgIxemXE6HwzQAVlQSGDYJgKOMbncyrt9stpiAWDAOFdMSBtjAcU8IcdTudxJcEPjCcSKqTMBAOGAKBQZI4UOhsHiZsyUCTJvjyZTDtSXm8YB8vrBfgMhQTFCyQSB4kA

open as <iframe src="[link above]">

What did you expect to happen?

I wanted to work with playground via iframe

What actually happened?

I am not sure if my actions caused the site to break, but I want to report what happened.

I tried to open stylelint.io/demo with code (via /#hash) in an iframe, but for some reason, it started to reload infinitely until the site went down. I suppose I made a small unconscious DoS attack (my laptop was working pretty hard)

Date and time: 25 Feb 2024 around 02:10 CET

@ybiquitous
Copy link
Member

@levchak0910 Thanks for the report. But I am afraid that I cannot reproduce the error. The demo seems to work correctly:

Screenshot 2024-02-26 at 15 23 56

I am using Firefox 123.0 on macOS Sonoma 14.3.1.

@ybiquitous ybiquitous added the status: needs clarification triage needs clarification from author label Feb 26, 2024
@levchak0910
Copy link
Author

@ybiquitous have you tried to open it in an iframe?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTLLO</title>
</head>
<body>
<iframe src="https://stylelint.io/demo/#N4Igxg9gJgpiBcIA8AXGBbADgGwIZoD4AdAOyJQGcJ0ZSkB6NLPQ0uilAT2xmJNwAEwNigDmAJwCWUALRMc+GDNziYuCvBHkA5INzatKbQCMBp49oDcIyNnHwBACwp4AFACYADABoBARk8AUl8AZiDfAFZAgEprEgBfNn4hERkZADEICAc-VXQ4xLIihg5uXhBvEAAzSR4AOVwaBBAYAA9GnBgAOgA3AFc4SsgSGtFm4RIBASIW1rQSKAoZhwBtUimpmdKebEkSFBlh0ZkOXAWVKBnvdY2trh29g6PJURlVSHQaBZhZftoQG4AXVI8Qq4AgIxemXE6HwzQAVlQSGDYJgKOMbncyrt9stpiAWDAOFdMSBtjAcU8IcdTudxJcEPjCcSKqTMBAOGAKBQZI4UOhsHiZsyUCTJvjyZTDtSXm8YB8vrBfgMhQTFCyQSB4kA" frameborder="0"></iframe>
</body>
</html>

@ybiquitous
Copy link
Member

Ah, I see. I am not sure about details, but opening the demo site in <iframe> may need some hacks like:

const FRAME_ORIGIN = 'https://chimerical-trifle-8d3c21.netlify.app';

@ybiquitous ybiquitous changed the title Site is down Cannot open demo in <iframe> Feb 26, 2024
@ybiquitous
Copy link
Member

Honestly, I don't think we need to support this way, right?

@levchak0910
Copy link
Author

levchak0910 commented Feb 26, 2024

I would like to share my case.

I wanted to show the stylelint capabilities in the iframe, in a presentation I am preparing for the conference.
Initially, I was looking for other solutions like in-browser editor. But it doesn't support the content of .vue files with scss syntax, because postcss-scss uses some nodejs api, which fails in the browser. Also, it doesn't support Vue3.

So, I decided to check how your demo is implemented. It looks quite complicated to repeat in my presentation, so I decided to show via an iframe, but infinite reload doesn't let me do it.

If your team don't want to support it - that is totally fine, you can close the issue. I still can exit a presentation and navigate to the /demo page by a link.

@ybiquitous
Copy link
Member

I understand your background. Our demo is implemented by WebContainers of StackBlitz (see also stylelint/stylelint-demo#351), so please take a look at the doc.

@ota-meshi Do you have any thoughts about this issue? If nothing in particular, I will close this issue.

@ota-meshi
Copy link
Member

ota-meshi commented Feb 27, 2024

Cross-origin isolation is required for the demo to work.
https://developer.stackblitz.com/platform/webcontainers/browser-support#cross-origin-isolation

Stylelint site does several things to make it work.

for="/demo"
[headers.values]
Cross-Origin-Embedder-Policy = "require-corp"
Cross-Origin-Opener-Policy = "same-origin"

allow="cross-origin-isolated"

if (!window.crossOriginIsolated) {

See also https://github.com/stylelint/stylelint.io/pull/306/files

@ybiquitous
Copy link
Member

@ota-meshi Thanks for sharing the info about cross-origin stuff.

@levchak0910 Please try the advice in your app. I hope you're doing well in your presentation.

@ybiquitous ybiquitous closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
@levchak0910
Copy link
Author

@ybiquitous @ota-meshi thank you both for info and support )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification triage needs clarification from author
Development

No branches or pull requests

3 participants