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
This commit is contained in:
Cédric de Saint Martin 2011-11-29 17:57:23 +01:00
parent c3a172b98c
commit acde678421
1 changed files with 6 additions and 1 deletions

View File

@ -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('/'));
}
};