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 RDP connection string consists of the following main components:

[protocol]://[domain]/rdpdirect.html?[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 (&). A parameters list can be found here.

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:

A minimal connection string can look like this:

https://mygateway.com/rdpdirect.html?server=192.168.12.55&port=3389&gateway=mygateway.com

Connecting to 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

You only need to add some extra parameters:

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

Connecting to RemoteApp in a new 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();