Commit 4ab9c4a for novnc.com
commit 4ab9c4a6ab0526744c9d1c439d6efb26834f7c87
Author: Logan Besecker <3487677+lbesecker195@users.noreply.github.com>
Date: Mon Sep 14 01:50:07 2026 -0700
Read boolean query parameters properly in vnc_lite.html
readQueryVariable() returns the query value as a string, so
?view_only=false and ?scale=0 were set as the strings "false" and "0".
Both are truthy, which made the session view only and scaled.
Add a readQueryBoolean() helper that treats "0", "no" and "false" as
false, like the checkbox settings in vnc.html, and use it for view_only
and scale.
Fixes #1662
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
diff --git a/vnc_lite.html b/vnc_lite.html
index 96ee5ac..a9f4623 100644
--- a/vnc_lite.html
+++ b/vnc_lite.html
@@ -123,6 +123,20 @@
return defaultValue;
}
+ // This function reads a boolean variable from the query string.
+ // The values "0", "no" and "false" are false and any other value
+ // is true, like the settings in vnc.html. If the variable isn't
+ // defined in the URL it returns the default value instead.
+ function readQueryBoolean(name, defaultValue) {
+ const value = readQueryVariable(name);
+
+ if (value === undefined) {
+ return defaultValue;
+ }
+
+ return !['0', 'no', 'false'].includes(value.toLowerCase());
+ }
+
document.getElementById('sendCtrlAltDelButton')
.onclick = sendCtrlAltDel;
@@ -169,8 +183,8 @@
rfb.addEventListener("desktopname", updateDesktopName);
// Set parameters that can be changed on an active connection
- rfb.viewOnly = readQueryVariable('view_only', false);
- rfb.scaleViewport = readQueryVariable('scale', false);
+ rfb.viewOnly = readQueryBoolean('view_only', false);
+ rfb.scaleViewport = readQueryBoolean('scale', false);
</script>
</head>