WEBBROWSER

Concept Link IconSee also Concept Link IconExample

Web browser control management, including navigation.

WebVue support - No. Returns an unsuccessful code if used in this context.

Mode

Mnemonic

Syntax

WebVue support

1 NAVIGATE 1 No
2 BACK 2 No
3 FORWARD 2 No
4 REFRESH 2 No
5 GETSOURCEINFO 3 No
6 PRINTTOPDF 4 No
7 OPENDEVTOOLS 2 No
8 CLEAR 5 No
10 SNAPSHOT 6 No
11 EXECUTESCRIPT 7 No
12 LOADCONTENT 8 No
13 MUTE 5 No
14 ENABLENAVIGATION 5 No
15 GETZOOMFACTOR 2 No
16 SETZOOMFACTOR 9 No
17 SETTRACE 10 No

 

Arguments common to more than one mode

Argument

Meaning

Window The name of the window that contains the Web browser control. Type STR.
Branch The branch (if any) of the window. Use "*" to indicate the current branch of the program. Type STR.
Identity The identity of the Web browser control within the specified window. Type STR.

Syntax 1

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Uri);

Return type: LONG.

Argument

Meaning

Uri

A Uniform Resource Identifier. Type STR.
Examples: https://example.com, file://C:\MyFolder\MyFile.pdf or file://MyFile.pdf
The filesystem syntax with an absolute or relative path is also supported, for example C:/MyFolder/MyFile.pdf
If the path is relative, it is relative to the TP folder.

Execution

Mode

Mnemonic

Action

1

NAVIGATE Load and display the content corresponding to the Uri.
Return: 1 if successful, else 0.

Syntax 2

LongVal = WEBBROWSER(Mode, Window, Branch, Identity);

Return type: LONG.

Execution

Mode

Mnemonic

Action

2

BACK Navigate to the previous page in the navigation history.
Return: 1 if successful, else 0.
3 FORWARD Navigate to the next page in the navigation history.
Return: 1 if successful, else 0.
4 REFRESH Reload the current top-level document.
Return: 1 if successful, else 0.
7 OPENDEVTOOLS Open the developer tools.
Return: 1 if successful, else 0.
15 GETZOOMFACTOR Return the current zoom factor in percentage. Range 25 to 500.
Default zoom factor is 100 (100%).

Syntax 3

StrVal = WEBBROWSER(Mode, Window, Branch, Identity[, Info]);

Return type: STR.

Argument

Meaning

Info

The type of information to be returned. Type INTEGER.
0 for the content Uri (default)
1 for the document title

Execution

Mode

Mnemonic

Action

5 GETSOURCEINFO Returns the requested information if successful, else an empty string.

Syntax 4

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Filename [, Overwrite]);

Return type: LONG.

Argument

Meaning

Filename The name of the Pdf file to print to. Type STR.
Overwrite

Flag to overwrite the file if it already exists. Type INTEGER.

0 - Do not overwrite (default)

1 - Overwrite

Execution

Mode

Mnemonic

Action

6

PRINTTOPDF

Print the content to a Pdf file using default printer settings.
Return: Always 1.

Syntax 5

LongVal = WEBBROWSER(Mode, Window, Branch, Identity[, Action]);

Return type: LONG.

Argument

Meaning

Action A flag. See below for details according to the mode. Default 0. Type INTEGER.

Execution

Mode

Mnemonic

Action

8

CLEAR

Clear navigation data
Action = 0 - Clear the cache
Action = 1 - Clear the cookies
Return: 1 if successful, else 0.

13 MUTE Mute or unmute sound
Action = 0 - Unmute the sound
Action = 1 - Mute the sound
Return: 1 if successful, else 0.
14 ENABLENAVIGATION Enable or disable navigation
Action = 0 - Disable navigation
Action = 1 - Enable navigation
Return: 1 if successful, else 0.
The same cache and user data folder is common to all instances of the Web browser control for a given installation of PcVue. Clearing the cache or deleting the cookies in one instance of the Web browser will affect all instances.

Syntax 6

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Filename);

Return type: LONG.

Argument

Meaning

Filename

The name of a file. If the file name is relative, it is relative to the project's TP folder. Type STR.

Execution

Mode

Mnemonic

Action

10 SNAPSHOT Take a screenshot of the contents of the Web browser control and save it as an jpg image in a file named Filename.
Return: 1 if successful, else 0.

Syntax 7

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Script);

Return type: LONG.

Argument

Meaning

Script A string containing a piece of inline JavaScript. Type STR.
For example: "document.body.style.backgroundcolor = 'salmon'".

Execution

Mode

Mnemonic

Action

11

EXECUTESCRIPT

Execute the JavaScript Script.
Return: 1 if successful, else 0.

Syntax 8

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Content);  

Return type: LONG.

Argument

Meaning

Content Web content to be rendered. Type STR.

Execution

Mode

Mnemonic

Action

12

LOADCONTENT

Render the web content passed with the argument Content.
Return: 1 if successful, else 0.

Syntax 9

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, ZoomFactor);

Return type: LONG.

Argument

Meaning

ZoomFactor The browser zoom factor in percentage. Range 25 to 500. Type INTEGER.
Default zoom factor is 100 (100%).

Execution

Mode

Mnemonic

Action

16

SETZOOMFACTOR

Set the browser zoom factor.
Return: 1 if successful, else 0.

Syntax 10

LongVal = WEBBROWSER(Mode, Window, Branch, Identity, Level);

Return type: LONG

Argument

Meaning

Level The trace level. Type INTEGER.

Execution

Mode

Mnemonic

Action

17

SETTRACE

Dynamically set the Web browser control trace level.
0 – No traces
1 – Configured traces
2 – Verbose mode
Return: 1 if successful, else 0.

Example

For an example, select the Example link above.