---
title: "WebView (_WebView class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/628654200/WebView%20(_WebView%20class)"
format: markdown
---
> Macro (toc)

---

This class represents an internal WebView object able to load and display an URL web page in a rectangle area.

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.

# Show

This function shows the WebView if it is hidden, otherwise does nothing.

#### Syntax

```visualbasic
Function Show()
```

# Hide

This function hides the WebView if it is displayed, otherwise does nothing.

#### Syntax

```visualbasic
Function Hide()
```

# Launch

This function launches the internal WebView with the URL provided, 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 changes the URL to the one provided.

#### Syntax

```visualbasic
Function Launch(x As Long, y As Long, width As Long, height As Long, url As Text, Optional cookies As AddressOf Array[] As ByteString := Nothing) As Boolean
```

#### Parameters

x

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

y

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

width

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

height

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

url

[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/512327836) as the URL we want the WebView to launch with. URLs not specifying a protocol are automatically prefixed with `http://`. Basic HTTP authentication is possible only via http protocol, example URL `http://username:password@www.example.com`.

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 used to launch the WebView 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 closes the WebView if it is running, otherwise does nothing.

#### Syntax

```visualbasic
Function Close()
```

# 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()
```

# OnCrash

This event is invoked by the system when this WebView crashes unexpectedly.

#### Syntax

```visualbasic
Event OnCrash As Process()
```

# SetSize

This function sets the rectangle size of the WebView.

#### Syntax

```visualbasic
Function SetSize(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.

# SetPosition

This function sets the screen position of the WebView.

#### Syntax

```visualbasic
Function SetPosition(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 screen X coordinate of the top left corner.

y

[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) as the screen 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.

# IsLaunched

This function checks and returns if the WebView is running.

#### 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

# 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 percent).

#### Return value

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

# GetCurrentUrl

This function gets the current URL of a launched WebView.

#### Syntax

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

#### Parameters

url

[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.

# ClearCookies

This function deletes all persistent web cookies on the device for all the WebViews. Only works if no WebView is 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 deletes cache on the device for all the WebViews. Only works if no WebView is launched.

> ℹ️ Firmware 21.30 or later is required.

#### 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 deletes data on the device for all the WebViews. Only works if no WebView is launched.

> ℹ️ Firmware 21.30 or later is required.

#### 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.

# Reload

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

#### 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.