---
title: "WebViewBox"
canonical: "https://docs.cuesystem.com/space/CVCGC/640614460/WebViewBox"
format: markdown
---
> Macro (toc)

---

# Description

The WebViewBox object loads a given URL web page and shows it in an interactive window. It is able to load any web URL over HTTP/S protocol.

WebView is based on the [WPE](https://wpewebkit.org/) platform.

For WebView limitations, see [Cue System Limits](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510787585/CUE+System+limits#WebView).

> ⚠️ **Firmware 20.00 or later** is required, and panels in revision R22 or higher are required.

> ℹ️ WebView class is **not fully supported in the simulation** in the Cue Visual Composer. All commands that return a boolean value return False in the simulation in the Cue Visual Composer.

# Properties

|  |  |  |  |  |
| --- | --- | --- | --- | --- |
| Property Name | Data Type | Allowed Values | Default Value | Description |
| Behavior |
| URL | Text | Any | Empty Text | The URL to launch the WebView with. Should have the HTTP/S prefix. Basic HTTP authentication is possible only via HTTP, example `http://username:password@www.example.com`. |
| Appearance |
| FillColor | Long | Any | _COLOR_WHITE | Defines the rectangle fill color when WebView is not launched |
| ShowURL | Boolean | True  
False | True | States if URL should be drawn onto the rectangle when WebView is not launched |
| URLFont | Address Of _Font |  | fntDefault16 | The font family and size for the rectangles URL Text |
| URLFontColor | Long | Any | _COLOR_BLACK | The font color fo the rectangles URL Text |

# Functions

## ShowObject

This function shows this graphic object if it is hidden, otherwise does nothing.

#### Syntax

```visualbasic
Function ShowObject()
```

## HideObject

This function hides this graphic object if it is displayed, otherwise does nothing.

#### Syntax

```visualbasic
Function HideObject()
```

## SetObjectSize

This function sets this graphic objects width and height.

#### Syntax

```visualbasic
Function SetObjectSize(width As Long, height As Long) As Boolean
```

#### Parameters

width

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the new width to set.

height

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the new height to set.

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## GetObjectSize

This function returns this graphic objects width and height.

#### Syntax

```visualbasic
Function GetObjectSize(ByRef width As Long, ByRef height As Long)
```

#### Parameters

width

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the reference where this objects width gets saved.

height

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the reference where this objects height gets saved.

## SetObjectPosition

This function sets this graphic objects position relative to the parent window.

#### Syntax

```visualbasic
Function SetObjectPosition(x As Long, y As Long) As Boolean
```

#### Parameters

x

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the X coordinate of the top left corner.

y

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the Y coordinate of the top left corner.

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## GetObjectPosition

This function returns this graphic objects position relative to the parent window.

#### Syntax

```visualbasic
Function GetObjectPosition(ByRef x As Long, ByRef y As Long)
```

#### Parameters

x

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the reference where X coordinate of the top left corner gets saved.

y

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the reference where Y coordinate of the top left corner gets saved.

## Launch

This function launches the internal WebView with the URL in the URL property, function does nothing if there already is another launched WebView as only one can be running at a time. If the WebView is already launched, it then reloads the browser with the URL property. This graphic object must be visible, else this function returns False.

#### Syntax

```visualbasic
Function Launch(Optional cookies As AddressOf Array[] As ByteString := Nothing) As Boolean
```

#### Parameters

cookies (*firmware 21.40 or later is required*)

Array[] As [ByteString](https://cue.atlassian.net/wiki/x/FQFvHg) Optional, defaults to Nothing. An array of cookies to launch the WebView with. Cookies use the [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie) header format. The URL property is not used for cookies so the *Domain* attribute is mandatory. Cookies are by default valid only for the current session, if you wish for the cookie to persist across launches the *Expires *attribute is necessary. Note that providing an invalid cookie with fail the launch. For reference a minimal valid cookie would look like this: `name=value; Domain=example.com`.

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if launch successful, False otherwise.

## Close

This function shuts down the internal WebView if it is launched, otherwise does nothing.

#### Syntax

```visualbasic
Function Close()
```

## IsLaunched

This function checks and returns if the WebView is launched.

#### Syntax

```visualbasic
Function IsLaunched() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if launched, False otherwise

## SetUrl

This function sets the URL property to the given value.

#### Syntax

```visualbasic
Function SetUrl(newurl As Text)
```

#### Parameters

newurl

[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/512327836) as the new URL for the next [Launch](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/640614460/WebViewBox#Launch).

## GetUrl

This function gets the URL property value.

#### Syntax

```visualbasic
Function GetUrl(ByRef geturl As Text)
```

#### Parameters

geturl

[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/512327836) as the reference to where to store the URL property value.

## GetCurrentUrl

This function gets the current URL of a launched WebView (not the URL property).

#### Syntax

```visualbasic
Function GetCurrentUrl(ByRef geturl As Text) As Boolean
```

#### Parameters

geturl

[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/512327836) as the reference to where to store the current URL, it can be up to 1000 characters long.

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## SetZoom

This function sets the web page zoom amount of a launched WebView.

#### Syntax

```visualbasic
Function SetZoom(zoom As Long) As Boolean
```

#### Parameters

zoom

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the zoom amount, value can be from 50 to 200 (in %).

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## Reload

This function reloads the current URL of a launched WebView. It does not clear cache however.

#### Syntax

```visualbasic
Function Reload() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## GoBack

This function goes one step back in the URL history of a launched WebView.

#### Syntax

```visualbasic
Function GoBack() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise. Returns True even if there is no more history to go back to.

## GoForward

This function goes one step forward in the URL history of a launched WebView.

#### Syntax

```visualbasic
Function GoForward() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise. Returns True even if there is no more history to go forward to.

## ClearCookies

This function clears cookies for all WebViews on this device. Only works if no WebView is currently launched.

#### Syntax

```visualbasic
Function ClearCookies() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## ClearCache

This function clears cache for all WebViews on this device. Only works if no WebView is currently launched.

> ℹ️ Firmware 21.30 or later is required and panels in revision R22 or higher are required. The current version of appCUE does not have this feature implemented.

#### Syntax

```visualbasic
Function ClearCache() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

## ClearData

This function clears data for all WebViews on this device. Only works if no WebView is currently launched.

> ℹ️ Firmware 21.30 or later is required and panels in revision R22 or higher are required. The current version of appCUE does not have this feature implemented.

#### Syntax

```visualbasic
Function ClearData() As Boolean
```

#### Return value

[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) True if successful, False otherwise.

# Events

## OnPageLoadStart

This event is invoked by the system when this WebView starts to load a webpage.

#### Syntax

```visualbasic
Event OnPageLoadStart As Process()
```

## OnPageLoadEnd

This event is invoked by the system when this WebView completes loading a webpage.

#### Syntax

```visualbasic
Event OnPageLoadEnd As Process()
```

# Example application