"loadSnippet"
Using this function an HTML page for the JavaScript Interface can be loaded within the WebView EWO.
Synopsis
void shape.loadSnippet(stringurl);
Description
The function loads the stated path inside of the EWO and provides the oaJsApi library.
The loaded file must not included <html>, <head> or <body> tags as these are generated automatically.
By default the host name of the event manager is used as well as the default port of the WinCC OA web server (Windows: 80/443, Linux: 8080/8443).
If the web server is not located on the same host as the event manager or a non default port is used the configuration can be changed using the config entry [ui] httpServer.
Example
[ui]
httpServer="https://first_redu:6655"
In case of a redundant project the active web server is automatically used in case the stated host name is one of the redundancy partners.
Example
Following example loads the file myHtmlFile.htm in which JavaScript code has been placed to be interact with the oaJsApi interface.
main()
{
WebView_ewo1.loadSnippet("/data/html/myHtmlFile.html");
}
When using the JavaScript Interface within the ULC UX (the combination of loadSnippet() and ulcClientSideWidget = true) the Web Socket enables local access to the oaJsApi which can potentially be used to e.g. directly manipulate data point values from within the developer console of a web browser.
loadSnippetFinished
This event is triggered when loadSnippet() has finished loading an HTML page into the WebView.ewo. This event is also triggered for WebView.ewo in ULC UX if ulcClientSideWidget is set to true (in contrast to loadFinished, which is not triggered under these circumstances).
Assignment
WebView EWO, WebView EWO - JavaScript Interface