-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add support for image previews of JPEG files in insecure http mode #7082
Comments
This does actually work, but I think it might require a secure context because it relies on some browser features only available in secure contexts. Are you able to use https or add an exception for |
i guess i can do that with a self signed https, will try, but not the best user experience for n00bs |
Yeah, it would be handy if we could support http, but VS Code relies on service workers for web views, and browsers only allow those in a secure context, so our hands are tied. I think this could possibly be changed upstream in VS Code, but trying to patch it here is out of scope I think. |
If you do try to submit a PR to VS Code, I think as mentioned the reason this happens is because image previews use web views, and web views ("web views" are a VS Code term I believe, they are implemented with iframes) use service workers (to route network requests through the server), which browsers only allow in secure contexts. So to make it work in http the preview would have to no longer use service workers, which may not be possible because they are used to provide isolation and it might be a security risk. Still, for the image preview case at least maybe it is possible to use a simpler version of a web view that does not need any service workers? Not sure though, some investigation would be required. |
What is your suggestion?
Add support for image previews of JPEG files when served via the VS Code web server, allowing users to view image content directly in the browser without needing to download or open the files separately.
Why do you want this feature?
This feature would improve user experience by enabling quick visualization of image assets directly in the web server interface, which is particularly useful for web developers, designers, and anyone working with visual media. It would save time and streamline workflows, especially when dealing with multiple images.
Are there any workarounds to get this functionality today?
Currently, users can manually open JPEG files in a browser tab or use third-party tools to preview images. However, these workarounds disrupt the development workflow and are less efficient compared to having built-in preview support.
Are you interested in submitting a PR for this?
Potentially, yes, it would be a great learning experience
The text was updated successfully, but these errors were encountered: