How can I Detect a Connection Event with TTWeb?
There may be times when you wish to take action when TTWeb connects, disconnects or attempts to connect to a host system. This Javascript snippet can be dropped into a web page to do just that.
<script type="text/javascript" for="sampleTTWeb" event="CommConnectEvent(connectInt,manualAction)"> switch(connectInt) { case 0: //A connection has been closed alert("Host connection closed!"); break; case 1: //A connection has been opened alert("Host connection established!"); break; case 2: //Attempting to connect alert("Attempting to connect to host system"); break; } </script>
The TTWeb CommConnectEvent
event returns connectInt
, an integer value which indicates the new TTWeb state.
0
= TTWeb has closed a connection
1
= TTWeb has opened connection
2
= TTWeb is attempting to connect
Ensure that the for
value matches the name
parameter specified when you instantiate TTWeb (in
the samples included with TTWeb this is 'sampleTTWeb
', as above.)
- Details
- Category: TTWeb
- Last Updated: 04 June 2015
- Hits: 3969