Setting the User Agent

If Corda Server™ knows what Web browser a client is using, it can return optimized (i.e., shorter and without Javascript*) HTML for embedding the Corda® image. To use this feature, you must pass the appropriate information to Corda Embedder using the userAgent attribute. For example:

myImage.userAgent = request.getHeader("USER-AGENT");

Set the userAgent attribute to the value of the HTTP User Agent environment variable. How you access this variable depends on the programming environment. This section lists the appropriate procedure for some common programming environments.

Important: It is not necessary to tell Corda Embedder the client's user agent, but you cannot take advantage of optimized HTML without doing so.

ASP

To access the HTTP User Agent environment variable in ASP, use the following:

myImage.userAgent = Request.ServerVariables("HTTP_USER_AGENT")

ASP.NET

To access the HTTP User Agent environment variable in ASP.NET, use the following:

C#  myImage.userAgent = Request.UserAgent;

Visual Basic  myImage.userAgent = Request.UserAgent

Cold Fusion

To access the HTTP User Agent environment variable in ColdFusion*, use the following:

myImage.userAgent = Request.ServerVariables("HTTP_USER_AGENT");

Java Server Pages

To access the HTTP User Agent environment variable with Java* Corda Embedder, use the following:

myImage.userAgent = request.getHeader("USER-AGENT");

Java Servlets

To access the HTTP User Agent environment variable with Java Corda Embedder, use the following:

myImage.userAgent = request.getHeader("USER-AGENT");

PERL

Accessing the HTTP User Agent in PERL varies by platform. In Windows*, for example, access it with the following:

$myImage->userAgent($ENV{'HTTP_USER_AGENT'});

PHP

To access the HTTP User Agent environment variable with PHP, use the following:

$myImage->userAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];