Platform SDK: Web Telephony Engine

Determining Whether the Phone or Browser is Being Used

In a dual-access application, you often need to determine, at run time, whether an application's pages are being rendered by the WTE or by a graphical browser. For example, before attempting to perform telephony operations, you would need to be sure your application is being rendered by the WTE.

You can use the hostName property of the External (ExOM) object in your scripts and Microsoft ActiveX® controls to determine which component is running your application. When an application is running under the WTE, the hostName property is "Microsoft Web Telephony Engine"; otherwise, it is null.

The following example shows how to use the hostName property in a script to set up conditional sections of code:

<html>
<body>
<script>
// hostname is not implemented in graphical browsers, so
//   start with this check
var IsMSWTE = (typeof(window.external.hostName)=="string")
 
if (IsMSWTE == true)
{
  IsMSWTE = (window.external.hostName == "Microsoft Web Telephony Engine");
} 
 
if (IsMSWTE == true)
{
  // Put Web telephony-specific code here
}
 
else
{
  // Put browser-specific code here
}
</script>