From acde6784211c33d0ada9905f999ea604525e9600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= Date: Tue, 29 Nov 2011 17:57:23 +0100 Subject: [PATCH] Use current pathname for path if path is not specified If no path parameter is specified, it will use current pathname, i.e my/no/vnc for http://www.mydomain.com/my/no/vnc/vnc.html --- include/ui.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ui.js b/include/ui.js index 74a0005c..b5b2d92b 100644 --- a/include/ui.js +++ b/include/ui.js @@ -53,7 +53,7 @@ load: function() { UI.initSetting('cursor', false); UI.initSetting('shared', true); UI.initSetting('connectTimeout', 2); - UI.initSetting('path', ''); + UI.initSetting('path', UI.getCurrentPath()); UI.rfb = RFB({'target': $D('noVNC_canvas'), 'onUpdateState': UI.updateState, @@ -620,6 +620,11 @@ setBarPosition: function() { var vncwidth = $D('noVNC_screen').style.offsetWidth; $D('noVNC-control-bar').style.width = vncwidth + 'px'; +}, + +getCurrentPath: function() { + var pathname = window.location.pathname; + return pathname.substring(1, pathname.lastIndexOf('/')); } };