Tutorial: Displaying Web Contents
Displaying websites in a visualization
Requirement: A visualization is open in a CODESYS project. The Visualization Toolbox and Properties views of the visualization are also open.
Drag the Web Browser element from Special Controls to the visualization editor.
Select the element in the editor.
In the Properties view, the element properties are listed for the Web Browser element.
In the property, specify the size (in pixels) for the Width and the Height (example:
600).In Control variables → URL property, specify the URL for the website (example:
'http://en.wikipedia.org').You can also specify a variable here (
STRINGorWSTRING) where the URL is assigned in the project.In the Control variables → Display property, specify a Boolean variable (example:
bSetURL).If the variable
bSetURLhas the valueTRUE, then the website'http://en.wikipedia.org'is displayed at runtime.
Configuring the buttons for forward and back navigation of the website
Requirement: The Web Browser element of your visualization is configured as described above.
In a POU, declare both Boolean variables
bGoBackandbGoForward.In the visualization editor, click the Web browser.
For the Controller variables → Back property, select the
bGoBackvariable from the Input Assistant. For the Control variables → Forward property, select thebGoForward.variable.In General Controls, add the Button element to your visualization two times.
Click a Button in the visualization editor and drag the Button to the required position (for example above the Web Browser element).
In the Texts → Text property, specify the
>character. In the Text properties → Font property, select a font from the Input Assistant (example:Arial, Bold, 14).Configure the Input configuration →
OnMouseClickproperty so that thebGoForwardvariable is toggled.Configure the second button for back navigation in the same way as described in Steps 5 to 7.
If the variable
bSetURLhas the valueTRUE, then the website'http://en.wikipedia.org'is displayed with the forward and back buttons. Click the buttons to navigate to the next web pages.