# Example

In the following example we'll put together a very simple browser-based application launcher that uses the RAS Web Client.

Before we begin, let's make sure that our RAS Secure Gateway configuration meets the requirements:

1. In the RAS Console, navigate to **Farm** > \<Site> > **Gateways**.
2. Right-click a Gateway and click **Properties**.
3. In the **Properties** tab, make sure that the **Enable RAS Secure Gateway in site** option is selected.
4. In the **User Portal** tab, make sure that the **Enable User Portal** option is selected.
5. Make sure that the Web Client opens in your default web browser.

We are now ready to create our custom resource launcher. In this example, we are making the following assumptions:

* Our Secure Gateway is running on the server with the following IP address: 192.168.10.10.
* Our web server is running on the server 192.168.20.20.
* The published resource that we'll be launching is Google Chrome and it's ID the in the RAS Console is "#4".

  You can look up the ID in the RAS Console (**Publishing >** select a resource **> Information tab >** look at the first field on the tab page, which displays the resource ID followed by resource name). Note that the pound sign (`#`) must be included together with the actual ID. You can also obtain a resource ID via RAS PowerShell by executing `Get-RASPubItem "resource-name"`. The returned `PubItem` object has the Id property that specifies the resource ID. To get the list of all available published resources, execute the `Get-RASPubItem` cmdlet with no parameters.

First we need to create a JSON payload containing user credentials and the application info. To do so, open a text editor and type (or paste) the following:

```
_RASWebClientLoadApp ({
    u: 'user-name',
    q: 'user-password',
    a: '#4',
    p: '',
        extra: {
            redirectPrinter: true,
            redirectLinks: true,
            redirectSound: true
        }
});
```

In the payload above, substitute 'user-name' and 'user-password' with your own. Change the "a:" parameter value to the ID of the published application that you wish to launch. Save the payload as a text file with the ".js" extension in the folder on your web server. In our example, we'll save the file as Google-Chrome.js in the wwwroot folder of our web server.

We now need to create a web page from where users will be launching our published application:

1. Create a simple HTML page and save it to a folder on a local web server from where it can be opened in a web browser.
2. Add the following link to the web page and name it "Google Chrome" (or use the name of your own application):

   `https://192.168.10.10/userportal/?appinfo=https://192.168.20.20/Google-Chrome.js#/launch`

   In the URL above, substitute the Gateway address (192.168.10.10) and the web server address (192.168.20.20) with your own, and use the ".js" file name that you created in previous steps.
3. Save the web page.

To test our custom launcher:

1. Open the web page in a browser.
2. Click the Google Chrome link (or the name you used).
3. The remote application will open in the browser using Parallels Web Client.
