novnc / noVNC

VNC client web application
https://novnc.com
Other
11.43k stars 2.27k forks source link

Hash links don't update config #1596

Open half-duplex opened 2 years ago

half-duplex commented 2 years ago

Describe the bug Changes in the URL hash don't propagate to the config, instead requiring a page reload to become active.

To Reproduce Steps to reproduce the behavior:

  1. Browse to vnc.html without get variables or hash
  2. Add #path=/other-websockify to URL
  3. Open devtools network inspector
  4. Click "Connect"
  5. See noVNC attempt to connect to /websockify despite the change

Expected behavior The hash change event was hooked and the config updated, so the application connects to /other-websockify

Client:

Server:

Additional context In addition to manual updates, this affects updates done by clicking links added to vnc.html, e.g. <a href="#path=/other-ws">...</a> I worked around this by adding the following line to addSettingsHandlers() in app/ui.js: window.addEventListener("hashchange", UI.initSettings, false);

CendioOssman commented 2 years ago

This is unfortunately non-trivial as we have to know which parts of the hash that the user actually cares about. We don't want to blindly overwrite settings the user has manually changed in the UI.

I'll leave this open though if someone wants to attempt a fix for this.