Wiring up Browser Tab Events in a Script
The Infinity Workflow and CDL interface are hosted inside UAD. This enables communication between the browser instance and the Workflow Engine. The following two methods can be used:

- Create a Browser tab and point it at the initial URL
- Create your script
-
At the start of the script you need to tell the Browser Tab that you wish to monitor it and get notified when various events happen. This is done using the Send Console Command:
The 1st parameter will allow you to specify which event you want to be notified of and is one of the following events:
- BROWSER_EVENTONCHANGE
- BROWSER_EVENTONCOMPLETE
- BROWSER_EVENTONNAVIGATING
- BROWSER_EVENTONTIMER
The 2nd Parameter is the name of the Browser Tab to be monitored i.e. “www – My CRM”
The 3rd Parameter is additional setting
-
Create a global function for GLOBAL_ONBROWSEREVENT. This function will be called when the Browser Tab has been changed based on the command you passed earlier. Within this function you can check the value of any HTML form element, script variable and act accordingly. HTML For Elements will be named in the following manner:
WEB_<type>_<element id/name>
You will also get a standard variable called WEB_CURRENTPAGE that holds the URL of the page the Browser Tab is showing.

This approach assumes that the page is refreshed by sending data to the server and being reloaded with the new data/values. However, some pages update using asynchronous methods that do not trigger the events listed in step 3 above.
In this case you can try using the BROWSER_ONTIMER trigger, or fire across javascript functions to trap elements getting/losing focus.
- On start of the agent Workflow, JavaScript is injected into the browser page. This enables events to be raised when an HTML element gets focus.
- When Infinity detects the browser page as been reloaded, it re-injects the JavaScript to continue receiving events from the new page.
- Infinity can push, and pull data between the agent Workflow and the browser page via the DOM.
When a control, within CDL, gets focus it raises an event to Infinity.
- These events are used to trigger the display of section information to the agent.
- At the same time any related knowledge articles are displayed, ready to be utilised by the agent.
Example: Get the GLOBAL_ONBROWSEREVENT function to fire using a jquery javascript function to listen for focus events on “input” elements. This example assumes the jquery library has been loaded by the webpage already (using the Send Console Command):
a) The following code enables events to be raised when an HTML element gets focus: $('input').focus(function(){window.external.InfinityPageEvent(this.id + '/' + this.name);}); b) The following code enables events to be raised when a drop-down list element gets focus. $(‘select').focus(function(){window.external.InfinityPageEvent(this.id + '/' + this.name);}); This wires up a callback event to an Infinity function called InfinityPageEvent, which will then trigger the GLOBAL_ONBROWSEREVENT function. This callback function accepts a single object as its input value, this will be passed to the script in the variable BROWSERPAGEDATA. |