Platform SDK: Web Telephony Engine

Event Objects

An event handler in a dual-access application can be called by both Internet Explorer and the WTE. When Internet Explorer calls an event handler, the handler uses the standard Internet Explorer event object to retrieve event-related information. When the WTE calls, the event handler uses the event object exposed through the WTE extended object model. The following example shows how to retrieve the appropriate event object:

<script language="VBScript" FOR=myControl EVENT="onchange">
    DIM  objEvent
 
    If UnderIVR Then
        Set objEvent = window.external.event
    Else
        Set objEvent = window.event
    End if
    .
    . // Process the event here.
    .
</script>

An application can determine if it is running under the WTE by checking the hostName property of the external object. For more information, see Determining Whether the Phone or Browser is Being Used.

The WTE delegates firing of the onclick event to the underlying WebBrowser control of Internet Explorer. This means that an event handler for the onclick event is always called by Internet Explorer, even when an application is running under the WTE. For this reason, an onclick event handler always uses window.event to retrieve event information. Similarly, because the onselectionerror and onselectiontimeout events are fired only by the WTE, the handlers for these events always use window.external.event to retrieve event information.