There are three different scripting contexts available to the Cogent DataHub and DataHub WebView:

  • Gamma runs in DataHub
  • Javascript runs in the browser
  • S# runs in DataHub WebView

Further, cross-context scripting is also supported:

  • WebView and browser can interact directly - WebView can call a Javascript function in the browser and Javascript can be used to pass S# to WebView.
  • WebView and server-side Gamma can interact indirectly - WebView can access server-side resources via WebRequests.

Calling DataHub WebView Scripts from JavaScript

The web page that hosts DataHub WebView can be programmed in JavaScript to interact with the WebView application. This allows the web page to modify the behaviour of DataHub WebView based on user interaction or data that is available to the web page. For example, the web page could use AJAX to query a database and then transmit data change events into DataHub WebView for display.

Calling JavaScript from DataHub WebView

DataHub WebView can be used to execute JavaScript on the web page that is hosting the WebView application. This allows DataHub WebView to update other parts of the web page based on actions or events within DataHub WebView.

Calling DataHub Gamma Scripts from DataHub WebView

DataHub WebView does not have direct access to gamma scripts stored in the Cogent DataHub...nor should it. Directly calling server-side resources poses a security threat. However, if the DataHub administrator chooses to allow it, Gamma scripts in the DataHub can be triggered either by hooking them to data point changes, or via WV.WebRequest. A similar mechanism is used to support ODBC Data.

Note: To enable cross-context scripting, the enablebrowserscripts initialization parameter must be set to true.