WebView2
WebView2 (Modern Web Browser)
WebView2 is a modern and powerful alternative to the standard WebBrowser object. By utilizing the Microsoft Edge (Chromium) browser engine, it allows you to display web pages and local files directly within your SCADA project’s Runtime screen, without needing an external browser.
This means you can seamlessly display modern web standards (HTML5, CSS3, JavaScript) and rich media content (video streams, PDF documents, complex device interfaces) that the legacy WebBrowser control (Internet Explorer) does not support.
For standard Properties, Advanced, and Events Panel settings not covered here, please refer to the Common Object Features page.
Common Use Cases
- Modern Device Interfaces: Displaying advanced web server (Web GUI) interfaces of next-generation PLCs, energy analyzers, or other smart devices with full compatibility.
- IP Camera Feeds: By entering the camera’s IP address into the “Source” property in the Advanced panel, modern video streams or camera web interfaces can be directly displayed.
- Local Reporting: Opening local .pdf files (e.g., maintenance reports) or HTML-based reports directly within SCADA.
- Video and Audio: Playing local (.mp4) or external (YouTube, etc.) video files and audio sources.
- External Information: Displaying complex websites or cloud-based dashboards (weather, raw material prices, production tracking panels) relevant to the operator.
- Custom SVG, HTML5, and 3D Visualizations: Creating custom indicators, animated process schematics, and interactive 3D screens connected to live SCADA tags using SVG, HTML5, CSS, JavaScript, and WebGL code written directly inside the SvgContent editor, without needing an external file or web address.
Properties Panel – Key Properties
Value
- Tag:
- Function: This is a two-way link connecting the web address (URL) currently displayed by the browser to a String tag.
- Read: If the linked tag (e.g., PLC_Web_URL_Tag) is changed to “
- http://192.168.1.10″ by a script, the browser automatically navigates to that address.
- Write: If the operator clicks a link inside the browser to navigate to a different page, the PLC_Web_URL_Tag is updated with this new URL.
Advanced Panel – Key Properties
- Source
- The default web address (URL) or local file path to load when the screen opens.
- Web Example: https://www.google.com
- Local File Example: C:\Reports\help.pdf
- Default: about:blank (Empty page)
- AllowExternalDrop
- If set to True (Default), it allows the operator to drag a file (e.g., .pdf, .jpg, .html, .mp4) from the desktop or a folder and drop it into the WebView2 control to view it instantly.
- ZoomFactor
- Adjusts the zoom level of the content.
- 1 is the default (100%). 0.5 reduces it to 50%, and 1.5 magnifies it to 150%.
- DefaultBackgroundColor
- The default background color displayed while the Source is loading or if it fails to load.
- SvgContent
- Located under the Misc category, this property allows you to design custom SVG, HTML5, CSS, JavaScript, and WebGL content that runs directly inside the WebView2 object without using an external web address (Source) or a local file.
- Clicking Open editor… next to the property opens the built-in Script code editor. This editor window includes the following tools:
- Code Area and View Tools: Provides a line-numbered code area, theme selection (such as Dark), code alignment, and zoom options.
- Compile: Performs syntax and structural checks on the code and lists any detected warnings or errors in the bottom message panel consisting of the Line, Priority, and Message columns.
- Preview: Allows you to preview your SVG or HTML5 design directly without switching to Runtime mode.
- OK / Cancel: Saves and applies your changes to the object, or cancels them.
Communicating with Live SCADA Tags
Code written inside SvgContent can communicate directly with tags in Wise SCADA Runtime. Tags that use live subscription must be declared in the code using the <!–WISE_TAGS [“TagName”] WISE_TAGS–> format.
- Reading Tags (window.WiseSvg): In the desktop Screen environment, window.WiseSvg?.subscribeTag(“TagName”, callback) listens to tag updates in real time, and window.WiseSvg?.getTag(“TagName”) reads the current value on demand.
- Writing Tags (Screen Script Bridge): When writing values to SCADA tags from within the interface is required, two-way messaging can be established with Screen_Load (or the relevant Screen C# script) through window.chrome.webview.postMessage(…).
For SVG, HTML5, and 3D SCADA screen development examples, code templates, and an AI-assisted design guide, see the Custom SCADA Screens and 3D Designs with SVG (yeni rehber sayfasının linki buraya eklenecek) guide.
Common Usage Examples
Example 1: Displaying a Static PDF Report
To show a read-only PDF user manual that the operator cannot modify.
- Add a WebView2 object to the screen.
- Go to the Properties (or Advanced) panel and find the Other category.
- Enter the full path of the PDF file into the Source property: C:\SCADA\MyProject\Documents\UserManual.pdf.
- Set the ZoomFactor property to a value that ensures the page fits well.
- Set the AllowExternalDrop property to False to prevent the operator from changing the displayed PDF.
Result: When the screen opens, the WebView2 object directly displays the UserManual.pdf file.
Example 2: Dynamic Device Interface Selection with Buttons
To allow the operator to switch between different device web interfaces by pressing buttons.
- Create a String type tag in your SCADA project: PLC_URL.
- Add a WebView2 object to the screen.
- Go to the Properties panel and bind the Tag property to the tag you created.
- Add two buttons to the screen: “PLC 1 Interface” and “Energy Analyzer”.
- Create a function on the Mouse Down event of the “PLC 1 Interface” button that sets the PLC_URL tag to “http://192.168.1.50”.
- Create a function on the Mouse Down event of the “Energy Analyzer” button that sets the PLC_URL tag to “http://192.168.1.60”.
Result: When the operator presses the “PLC 1 Interface” button, the PLC_URL tag updates, the WebView2 detects the change, and it loads the address http://192.168.1.50. When the other button is pressed, the address http://192.168.1.60 is loaded.
Example 3: Custom SVG Animation Bound to a Live Tag with SvgContent
To create a custom fan graphic that rotates or stops based on the state of a Bool tag:
- Create a Boolean tag named BoolTag in your SCADA project.
- Add a WebView2 object to the screen.
- Go to the Advanced panel, find the SvgContent property under the Misc category, and click Open editor… to open the Script editor.
- Paste the following SVG and JavaScript code into the editor:
HTML
<!--WISE_TAGS ["BoolTag"] WISE_TAGS-->
<svg id="fan" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 200 200" width="100%" height="100%" style="display:block;">
<circle cx="100" cy="100" r="90" fill="#263238"/>
<g fill="#29b6f6">
<path d="M100 90 C60 40 90 10 115 30 C135 50 115 75 100 90"/>
<path d="M110 100 C160 60 190 90 170 115 C150 135 125 115 100 100"/>
<path d="M100 110 C140 160 110 190 85 170 C65 150 85 125 100 110"/>
<path d="M90 100 C40 140 10 110 30 85 C50 65 75 85 90 100"/>
<animateTransform attributeName="transform" type="rotate"
from="0 100 100" to="360 100 100"
dur="5s" repeatCount="indefinite"/>
</g>
<circle cx="100" cy="100" r="15" fill="#eceff1"/>
</svg>
<script>
(() => {
const fan = document.getElementById('fan');
fan.pauseAnimations();
window.WiseSvg?.subscribeTag('BoolTag', value => {
if (value === true || String(value).toLowerCase() === 'true') {
fan.unpauseAnimations();
} else {
fan.pauseAnimations();
}
});
})();
</script>
Check the code with Compile on the top toolbar, preview the graphic with Preview, and click OK to save.
Result: When Runtime starts, the fan impeller begins rotating whenever BoolTag is True; when it becomes False, the fan stops naturally at its current angle without snapping back to its starting position.
