Skip to main content

5.2.2 – Passing parameters via URL (Connection String)

URL components

❗️ Important

Please use "on" and "off" for Boolean value if you are using URL to pass parameters.

Basically, a connection string consists of the following main components:

[protocol]://[domain]/RDP?[parameters]

The parameters are the same as the parameters that can be set in servers.json for each target system. Please note the correct URL encoding (see below)! Link paramters with the ampersand (&).

The correct URL encoding:

If characters are to be transmitted as values that have special meaning in the context of a URL, they must be encoded.
Example: name=SparkView Server becomes name=SparkView%20Server.

For correct encoding, an online tool can also be applied for help: https://meyerweb.com/eric/tools/dencoder/.

Example connection string:

https://mygateway.com/RDP?mapClipboard=on&playSound=0&decompressingRDP61=on&performanceflags=110&mapPrinter=on&sessionRecord=0&gateway=mygateway.com&account=Testuser&server=Desktop&width=1728&height=1000&gatewayAddr=https%3A%2F%2Fmygateway.com&_keyboard=1031

Connecting to desktop:

desktop

var parameters = "server=192.168.0.2&user=admin&pwd=" + encodeURIComponent("&=@#");
//use encodeURIComponent to escape special characters in value
var width = 800, height = 600, server_bpp = 16;
varr = new svGlobal.Rdp("http://" + gateway + "/RDP?" + parameters, width, height, server_bpp);
r.addSurface(new svGlobal.LocalInterface());
r.run();

Connecting to RemoteApp in current window:

window

You only need to add some extra parameters:

parameters += encodeURIComponent("startProgram=app&exe=||EXCEL");

Connecting to RemoteApp in a new window:

window

varparameters = "server=192.168.0.2&user=admin&pwd=" + encodeURIComponent("&=@#");
//use encodeURIComponent to escape special characters in value
parameters += encodeURIComponent("startProgram=app&exe=||EXCEL");
var width = 800, height = 600, server_bpp = 16;
var r = svManager.getInstance(); //try use the existed session.
if (r == null){
  r = new svGlobal.Rdp(protocol + gw + "/RDP?" + s, width, height, server_bpp);
}
var rail = window.open("rail.html");
function onSurfaceReady(surface){
  r.addSurface(surface);
  r.startApp(frmConn["exe"].value, frmConn["args"].value, "");
};
rail.svOnSurfaceReady = onSurfaceReady;
r.run();