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.

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: Showing modern video streams or camera web interfaces.
  • 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.

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.

Common Usage Examples

Example 1: Displaying a Static PDF Report

To show a read-only PDF user manual that the operator cannot modify.

  1. Add a WebView2 object to the screen.
  2. Go to the Properties (or Advanced) panel and find the Other category.
  3. Enter the full path of the PDF file into the Source property: C:\SCADA\MyProject\Documents\UserManual.pdf.
  4. Set the ZoomFactor property to a value that ensures the page fits well.
  5. 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.

  1. Create a String type tag in your SCADA project: PLC_URL.
  2. Add a WebView2 object to the screen.
  3. Go to the Properties panel and bind the Tag property to the tag you created.
  4. Add two buttons to the screen: “PLC 1 Interface” and “Energy Analyzer”.
  5. 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”.
  6. 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.

Leave a Reply