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

WebView reloading losses part of the URL #209242

Closed
memeplex opened this issue Apr 1, 2024 · 2 comments
Closed

WebView reloading losses part of the URL #209242

memeplex opened this issue Apr 1, 2024 · 2 comments
Assignees
Labels
*out-of-scope Posted issue is not in scope of VS Code webview Webview issues

Comments

@memeplex
Copy link

memeplex commented Apr 1, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.87.2
  • OS Version: macOS Sonoma

I'm trying to implement a previewer for revealjs. In order to keep the position after reloading the page, revealjs can modify the url so that the current slide is codified into it. For example:

vscode-webview://0gef76lffkg08sgsfjm6ap092nntn4qeau51md5p7mshebhakdn7/index.html?
id=135b047d-44a1-41cb-9860-c24a9a5de323&origin=cd7db645-6b05-49b7-895a-8ff85d338fb3
&swVersion=4&extensionId=undefined_publisher.insight&platform=electron
&vscode-resource-base-authority=vscode-resource.vscode-cdn.net
&parentOrigin=vscode-file%3A%2F%2Fvscode-app#/foobar

Notice the #/foobar at the end, it means that we are currently at the Foobar slide. Now, if I reload the WebView by setting its html attribute, the url becomes:

vscode-webview://0gef76lffkg08sgsfjm6ap092nntn4qeau51md5p7mshebhakdn7/index.html?
id=135b047d-44a1-41cb-9860-c24a9a5de323&origin=cd7db645-6b05-49b7-895a-8ff85d338fb3
&swVersion=4&extensionId=undefined_publisher.insight&platform=electron
&vscode-resource-base-authority=vscode-resource.vscode-cdn.net
&parentOrigin=vscode-file%3A%2F%2Fvscode-app

and so position is lost.

I believe you are storing the original url and setting it again each time contents get modified. Would it be possible to reload the iframe contents without modifying its url?

Related (in that they are alternatives that don't work):

@memeplex
Copy link
Author

memeplex commented Apr 1, 2024

I found out that recent versions of revealjs implement a vertical scroll mode that plays better with page reloading. So that's a workaround for my particular issue. Anyway, I believe that reloading the WebView should be similar to pressing C-R in the browser, like "reload the current url" instead of "here's the new url" (which often will be the same, but not in this case).

@mjbvz mjbvz added webview Webview issues *out-of-scope Posted issue is not in scope of VS Code labels Dec 9, 2024
Copy link

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*out-of-scope Posted issue is not in scope of VS Code webview Webview issues
Projects
None yet
Development

No branches or pull requests

2 participants