Class

# DesktopHTMLViewer

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Renders HTML and provides basic navigation features.

<div class="warning">

<div class="title">

Warning

</div>

Using this control on Linux with certain types of <span class="title-ref">hardware</span> can cause it to draw the contents improperly. Should you encounter this, see `this note<desktophtmlviewer.linux_support.drawing_issue>` for a resolution.

</div>

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                         | Type                                                       | Read-Only | Shared |
|--------------------------------------------------------------|------------------------------------------------------------|-----------|--------|
| `Active<desktophtmlviewer.active>`                           | `Boolean</api/data_types/boolean>`                         | ✓         |        |
| `AllowAutoDeactivate<desktophtmlviewer.allowautodeactivate>` | `Boolean</api/data_types/boolean>`                         |           |        |
| `AllowTabStop<desktophtmlviewer.allowtabstop>`               | `Boolean</api/data_types/boolean>`                         |           |        |
| `CanGoBack<desktophtmlviewer.cangoback>`                     | `Boolean</api/data_types/boolean>`                         | ✓         |        |
| `CanGoForward<desktophtmlviewer.cangoforward>`               | `Boolean</api/data_types/boolean>`                         | ✓         |        |
| `Enabled<desktophtmlviewer.enabled>`                         | `Boolean</api/data_types/boolean>`                         |           |        |
| `Handle<desktophtmlviewer.handle>`                           | `Ptr</api/data_types/additional_types/ptr>`                | ✓         |        |
| `Height<desktophtmlviewer.height>`                           | `Integer</api/data_types/integer>`                         |           |        |
| `Index<desktophtmlviewer.index>`                             | `Integer</api/data_types/integer>`                         |           |        |
| `Left<desktophtmlviewer.left>`                               | `Integer</api/data_types/integer>`                         |           |        |
| `LockBottom<desktophtmlviewer.lockbottom>`                   | `Boolean</api/data_types/boolean>`                         |           |        |
| `LockLeft<desktophtmlviewer.lockleft>`                       | `Boolean</api/data_types/boolean>`                         |           |        |
| `LockRight<desktophtmlviewer.lockright>`                     | `Boolean</api/data_types/boolean>`                         |           |        |
| `LockTop<desktophtmlviewer.locktop>`                         | `Boolean</api/data_types/boolean>`                         |           |        |
| `MouseCursor<desktophtmlviewer.mousecursor>`                 | `MouseCursor</api/user_interface/desktop/mousecursor>`     |           |        |
| `Name<desktophtmlviewer.name>`                               | `String</api/data_types/string>`                           | ✓         |        |
| `PanelIndex<desktophtmlviewer.panelindex>`                   | `Integer</api/data_types/integer>`                         |           |        |
| `Parent<desktophtmlviewer.parent>`                           | `Object</api/data_types/additional_types/object>`          |           |        |
| `Scope<desktophtmlviewer.scope>`                             | `Integer</api/data_types/integer>`                         | ✓         |        |
| `TabIndex<desktophtmlviewer.tabindex>`                       | `Integer</api/data_types/integer>`                         |           |        |
| `Tooltip<desktophtmlviewer.tooltip>`                         | `String</api/data_types/string>`                           |           |        |
| `Top<desktophtmlviewer.top>`                                 | `Integer</api/data_types/integer>`                         |           |        |
| `Transparent<desktophtmlviewer.transparent>`                 | `Boolean</api/data_types/boolean>`                         |           |        |
| `UserAgent<desktophtmlviewer.useragent>`                     | `String</api/data_types/string>`                           |           |        |
| `Visible<desktophtmlviewer.visible>`                         | `Boolean</api/data_types/boolean>`                         |           |        |
| `Width<desktophtmlviewer.width>`                             | `Integer</api/data_types/integer>`                         |           |        |
| `Window<desktophtmlviewer.window>`                           | `DesktopWindow</api/user_interface/desktop/desktopwindow>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                             | Parameters                                                                                                                                                                                                                                                    | Returns                            | Shared |
|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AcceptFileDrop<desktophtmlviewer.acceptfiledrop>`               | FileType As `String</api/data_types/string>`                                                                                                                                                                                                                  |                                    |        |
| `AcceptPictureDrop<desktophtmlviewer.acceptpicturedrop>`         |                                                                                                                                                                                                                                                               |                                    |        |
| `AcceptRawDataDrop<desktophtmlviewer.acceptrawdatadrop>`         | Type As `String</api/data_types/string>`                                                                                                                                                                                                                      |                                    |        |
| `AcceptTextDrop<desktophtmlviewer.accepttextdrop>`               |                                                                                                                                                                                                                                                               |                                    |        |
| `Cancel<desktophtmlviewer.cancel>`                               |                                                                                                                                                                                                                                                               |                                    |        |
| `Close<desktophtmlviewer.close>`                                 |                                                                                                                                                                                                                                                               |                                    |        |
| `DrawInto<desktophtmlviewer.drawinto>`                           | g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                                                     |                                    |        |
| `ExecuteJavaScript<desktophtmlviewer.executejavascript>`         | js As `String</api/data_types/string>`                                                                                                                                                                                                                        |                                    |        |
| `ExecuteJavaScriptSync<desktophtmlviewer.executejavascriptsync>` | js As `String</api/data_types/string>`                                                                                                                                                                                                                        | `Variant</api/data_types/variant>` |        |
| `GoBack<desktophtmlviewer.goback>`                               |                                                                                                                                                                                                                                                               |                                    |        |
| `GoForward<desktophtmlviewer.goforward>`                         |                                                                                                                                                                                                                                                               |                                    |        |
| `IsAvailable<desktophtmlviewer.isavailable>`                     |                                                                                                                                                                                                                                                               | `Boolean</api/data_types/boolean>` |        |
| `LoadPage<desktophtmlviewer.loadpage>`                           | Source As `String</api/data_types/string>`, RelativeTo As `FolderItem</api/files/folderitem>`                                                                                                                                                                 |                                    |        |
|                                                                  | File As `FolderItem</api/files/folderitem>`                                                                                                                                                                                                                   |                                    |        |
| `LoadURL<desktophtmlviewer.loadurl>`                             | URL As `String</api/data_types/string>`                                                                                                                                                                                                                       |                                    |        |
| `Print<desktophtmlviewer.print>`                                 | showPrintDialog As `Boolean</api/data_types/boolean>` = `True</api/language/true>`                                                                                                                                                                            |                                    |        |
| `PrintToPDF<desktophtmlviewer.print>`                            | file As `FolderItem</api/files/folderitem>`                                                                                                                                                                                                                   |                                    |        |
| `Refresh<desktophtmlviewer.refresh>`                             | immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                              |                                    |        |
|                                                                  | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |                                    |        |
| `SetFocus<desktophtmlviewer.setfocus>`                           |                                                                                                                                                                                                                                                               |                                    |        |
| `ZoomTextIn<desktophtmlviewer.zoomtextin>`                       |                                                                                                                                                                                                                                                               |                                    |        |
| `ZoomTextOut<desktophtmlviewer.zoomtextout>`                     |                                                                                                                                                                                                                                                               |                                    |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                                 | Parameters                                                                                          | Returns                            |
|----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|------------------------------------|
| `CancelLoad<desktophtmlviewer.cancelload>`                           | URL As `String</api/data_types/string>`                                                             | `Boolean</api/data_types/boolean>` |
| `Closing<desktophtmlviewer.closing>`                                 |                                                                                                     |                                    |
| `DocumentBegin<desktophtmlviewer.documentbegin>`                     | URL As `String</api/data_types/string>`                                                             |                                    |
| `DocumentComplete<desktophtmlviewer.documentcomplete>`               | URL As `String</api/data_types/string>`                                                             |                                    |
| `DocumentProgressChanged<desktophtmlviewer.documentprogresschanged>` | URL As `String</api/data_types/string>`, PercentageComplete As `Integer</api/data_types/integer>`   |                                    |
| `Error<desktophtmlviewer.error>`                                     | ErrorNumber As `Integer</api/data_types/integer>`, ErrorMessage As `String</api/data_types/string>` |                                    |
| `FocusLost<desktophtmlviewer.focuslost>`                             |                                                                                                     |                                    |
| `FocusReceived<desktophtmlviewer.focusreceived>`                     |                                                                                                     |                                    |
| `JavaScriptRequest<desktophtmlviewer.javascriptrequest>`             | method As `String</api/data_types/string>`, parameters() As `Variant</api/data_types/variant>`      | String                             |
| `KeyDown<desktophtmlviewer.keydown>`                                 | Key As `String</api/data_types/string>`                                                             | `Boolean</api/data_types/boolean>` |
| `KeyUp<desktophtmlviewer.keyup>`                                     | Key As `String</api/data_types/string>`                                                             |                                    |
| `NewWindow<desktophtmlviewer.newwindow>`                             | url As `String</api/data_types/string>`                                                             | DesktopHTMLViewer                  |
| `Opening<desktophtmlviewer.opening>`                                 |                                                                                                     |                                    |
| `PrintComplete<desktophtmlviewer.printcomplete>`                     |                                                                                                     |                                    |
| `PrintError<desktophtmlviewer.printerror>`                           | error As `RuntimeException</api/exceptions/runtimeexception>`                                       |                                    |
| `SecurityChanged<desktophtmlviewer.securitychanged>`                 | IsSecure As `Boolean</api/data_types/boolean>`                                                      |                                    |
| `StatusChanged<desktophtmlviewer.statuschanged>`                     | NewStatus As `String</api/data_types/string>`                                                       |                                    |
| `TitleChanged<desktophtmlviewer.titlechanged>`                       | NewTitle As `String</api/data_types/string>`                                                        |                                    |

## Property descriptions

<div id="desktophtmlviewer.active">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Active

**Active** As `Boolean</api/data_types/boolean>`

> Indicates whether the `control</api/user_interface/desktop/desktopuicontrol>` is active.
>
> Active is `False</api/language/false>` when the control's window is not in the foreground. When a `DesktopWindow</api/user_interface/desktop/desktopwindow>` is deactivated, its controls are automatically deactivated unless `AllowAutoDeactivate<desktopuicontrol.allowautodeactivate>` is set to `False</api/language/false>`.
>
> This property is read-only.

<div id="desktophtmlviewer.allowautodeactivate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AllowAutoDeactivate

**AllowAutoDeactivate** As `Boolean</api/data_types/boolean>`

Determines whether the control should be deactivated (on macOS) when the parent window is deactivated. The default is `True</api/language/true>`.

<div id="desktophtmlviewer.allowtabstop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AllowTabStop

**AllowTabStop** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the control is in the Tab Order and accepts the focus when the user tabs into it. The default is `True</api/language/true>`. If `False</api/language/false>`, the user cannot tab into it to give it the focus. However, the control can gain the focus by other means, such as the user's clicking on it or by setting the focus in code.
>
> This example removes the control from the Tab Order:
>
> ``` xojo
> Me.AllowTabStop = False
> ```

<div id="desktophtmlviewer.cangoback">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.CanGoBack

**CanGoBack** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, it indicates that there is a prior page that can be navigated to using `GoBack<desktophtmlviewer.goback>`.
>
> This property is read-only.
>
> This code in the `DocumentComplete<desktophtmlviewer.documentcomplete>` event handler disables a Back button if there is no prior page:
>
> ``` xojo
> BackButton.Enabled = Me.CanGoBack
> ```

<div id="desktophtmlviewer.cangoforward">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.CanGoForward

**CanGoForward** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, it indicates that there is a next page that can be navigated to using `GoForward<desktophtmlviewer.goforward>`.
>
> This property is read-only.
>
> This code in the `DocumentComplete<desktophtmlviewer.documentcomplete>` event handler disables a Forward button if there is no next page:
>
> ``` xojo
> ForwardButton.Enabled = Me.CanGoForward
> ```

<div id="desktophtmlviewer.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

> Determines if the control should be enabled when the owning window is opened.
>
> A disabled control cannot be clicked and cannot receive the focus.
>
> This example disables the control.
>
> ``` xojo
> Me.Enabled = False
> ```

<div id="desktophtmlviewer.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> Returns a handle to the control.
>
> This property is read-only.
>
> For interfacing with Mac APIs using `Declares</api/language/declare>`, **DesktopControl.Handle** returns NSViews (except for `DesktopToolbar</api/user_interface/desktop/desktoptoolbar>`).
>
> On Windows returns the HWND of the control.
>
> On Linux it returns a GtkWidget.
>
> The following gets a handle to the control.
>
> ``` xojo
> Var p As Ptr = Me.Handle
> ```

<div id="desktophtmlviewer.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Height

**Height** As `Integer</api/data_types/integer>`

> The height (in points) of the control.
>
> This example sets the height of the control to 100:
>
> ``` xojo
> Me.Height = 100
> ```

<div id="desktophtmlviewer.index">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Index

**Index** As `Integer</api/data_types/integer>`

> If the control is used in a control set, this specifies the control's index in the set.

<div id="desktophtmlviewer.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Left

**Left** As `Integer</api/data_types/integer>`

> The distance from the left side of the control to the left side of its containing window or container.
>
> The following example moves the control 100 points from the left side of the window:
>
> ``` xojo
> Me.Left = 150
> ```

<div id="desktophtmlviewer.lockbottom">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LockBottom

**LockBottom** As `Boolean</api/data_types/boolean>`

> Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning window.
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockBottom = True
> ```

<div id="desktophtmlviewer.lockleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LockLeft

**LockLeft** As `Boolean</api/data_types/boolean>`

> Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning window.
>
> LockLeft and Locktop default to `True</api/language/true>` when you add a new control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockLeft* has no effect unless *LockRight* is `True</api/language/true>`.
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockLeft = True
> ```

<div id="desktophtmlviewer.lockright">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LockRight

**LockRight** As `Boolean</api/data_types/boolean>`

> Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning window.
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockRight = True
> ```

<div id="desktophtmlviewer.locktop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LockTop

**LockTop** As `Boolean</api/data_types/boolean>`

> Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning window.
>
> LockTop and LockLeft default to `True</api/language/true>` when you add a control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockTop* has no effect unless *LockBottom* is `True</api/language/true>`.
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockTop = True
> ```

<div id="desktophtmlviewer.mousecursor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.MouseCursor

**MouseCursor** As `MouseCursor</api/user_interface/desktop/mousecursor>`

> The cursor to be displayed while the mouse is within the control and both the `DesktopApplication</api/user_interface/desktop/desktopapplication>` and `DesktopWindow</api/user_interface/desktop/desktopwindow>` class's MouseCursor properties are `Nil</api/language/nil>`.
>
> If the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class's MouseCursor property is not `Nil</api/language/nil>` or the `DesktopWindow</api/user_interface/desktop/desktopwindow>`'s MouseCursor property is not `Nil</api/language/nil>`, then any control's MouseCursor property is ignored. You can use a cursor stored in the `Cursors</api/user_interface/desktop/cursors>` module. On macOS, you can also obtain a `MouseCursor</api/user_interface/desktop/mousecursor>` from a resource file.
>
> This line in the Opening event of the control sets the default cursor to the finger pointer.
>
> ``` xojo
> Me.MouseCursor = System.Cursors.FingerPointer
> ```

<div id="desktophtmlviewer.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Name

**Name** As `String</api/data_types/string>`

> The name of the control. Set the name of the control in the Inspector.
>
> This property is read-only.

<div id="desktophtmlviewer.panelindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.PanelIndex

**PanelIndex** As `Integer</api/data_types/integer>`

> If the control has been placed on a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>` or `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` control, this is the panel (page/tab) that the control is on. If the control is not on a panel, it returns -1.
>
> The first panel is numbered zero. If the control has been placed on a panel of a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>` or `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` control, it returns the panel number. If the control is not on a `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` or `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`, it returns -1. If you change the PanelIndex to a nonexistent panel, the control will disappear until you give it a PanelIndex value that corresponds to a panel that exists.
>
> If you are looking to change the currently selected panel (page/tab), use `DesktopPagePanel<desktoppagepanel.selectedpanelindex>`.
>
> This code displays the panel index of the control that is on the page.
>
> ``` xojo
> MessageBox(Me.SelectedPanelIndex.ToString)
> ```

<div id="desktophtmlviewer.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Parent

**Parent** As `Object</api/data_types/additional_types/object>`

> Used to get and set the control's parent control or window.
>
> If the control is on the window, the Parent will be the `Window</api/user_interface/desktop/desktopwindow>`. If the control is on the container, the Parent will be the `container</api/user_interface/desktop/desktopcontainer>`. If the control is completed enclosed by another control, the Parent will be that `control</api/user_interface/desktop/desktopuicontrol>`.
>
> If you do not want the enclosing control to be the parent, set the Parent property of that control to `Nil</api/language/nil>` to make it the `Window</api/user_interface/desktop/desktopwindow>`.
>
> If the parent control is somehow in another window, an `InvalidParentException</api/exceptions/invalidparentexception>` will occur.
>
> The following example sets the parent of the control to the window.
>
> ``` xojo
> Me.Parent = Nil
> ```

<div id="desktophtmlviewer.scope">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Scope

**Scope** As `Integer</api/data_types/integer>`

> Used to determine whether access to the control is Public (0) or Private (2). The default is Public.
>
> This property is read-only.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This is a designtime-only property and thus can only be set in the Inspector and is not accessible via code.
>
> </div>
>
> If the Scope of a control is set to Private, it cannot be accessed from outside its parent window.

<div id="desktophtmlviewer.tabindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.TabIndex

**TabIndex** As `Integer</api/data_types/integer>`

> The control's position in the Tab Order. The control with whose TabIndex is 0 will get the focus first.
>
> On macOS, only controls where you enter data from the keyboard typically get the focus. In order to manually set focus to controls that don't allow keyboard entry, go to System Preferences, click on the Keyboard icon then on the Shortcuts tab and then check the *Use keyboard navigation to move focus between controls* checkbox.
>
> This example sets the control's TabIndex.
>
> ``` xojo
> Me.TabIndex = 2
> ```

<div id="desktophtmlviewer.tooltip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Tooltip

**Tooltip** As `String</api/data_types/string>`

> Text of help message displayed as a Windows or Linux "tooltip" or macOS help tag.
>
> The tip/tag is displayed when the user hovers the mouse cursor over the control.
>
> This example adds a tooltip to a control:
>
> ``` xojo
> Me.Tooltip = "Click to bark."
> ```

<div id="desktophtmlviewer.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Top

**Top** As `Integer</api/data_types/integer>`

> The distance from the top of the control to the top of its containing window or container.
>
> This example sets the top of the control to 140 points from the top of the window:
>
> ``` xojo
> Me.Top = 140
> ```

<div id="desktophtmlviewer.transparent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Transparent

**Transparent** As `Boolean</api/data_types/boolean>`

> Determines whether the control is transparent on Windows. The default is `False</api/language/false>`. Has no effect on macOS or Linux.
>
> Transparent controls draw more slowly and use more memory in order to cache the background. Unless you absolutely require transparency, leave this set to `False</api/language/false>`.
>
> For projects that were created prior to 2018r1, this property defaults to `True</api/language/true>` to emulate previous behavior. Consider changing it to `False</api/language/false>` to improve performance if you do not require transparency.

<div id="desktophtmlviewer.useragent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.UserAgent

**UserAgent** As `String</api/data_types/string>`

> Supports getting and setting a custom user agent string.
>
> UserAgent works on Linux, macOS and Windows.
>
> This example sets the UserAgent.
>
> ``` xojo
> If Me.IsAvailable Then
>   Var agent As String
>   agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"
>   Me.UserAgent = agent
> End If
> ```

<div id="desktophtmlviewer.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Visible

**Visible** As `Boolean</api/data_types/boolean>`

> Determines whether the control is visible when its owning window is opened. The default is `True</api/language/true>`: the control is visible.
>
> The following code makes the control invisible:
>
> ``` xojo
> Me.Visible = False
> ```

<div id="desktophtmlviewer.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Width

**Width** As `Integer</api/data_types/integer>`

> The width (in points) of the control.
>
> The following example resizes the control:
>
> ``` xojo
> Me.Width = 200
> ```

<div id="desktophtmlviewer.window">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Window

**Window** As `DesktopWindow</api/user_interface/desktop/desktopwindow>`

> The control's parent window.
>
> This property is read-only.
>
> This code gets the parent window's Title property.
>
> ``` xojo
> MessageBox(Me.Window.Title)
> ```

## Method descriptions

<div id="desktophtmlviewer.acceptfiledrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AcceptFileDrop

**AcceptFileDrop**(FileType As `String</api/data_types/string>`)

> Permits documents of type *FileType* to be dropped on the control. *FileType* must be a file type that you defined in via the `FileType</api/files/filetype>` class or the File Type Sets Editor.
>
> This code in the Opening event makes it possible for the user to drop either a picture or a file that is a jpeg image. The File Type Sets editor was used to define the “image/jpeg” file type. It is one of the “Common File Types” that is available in the editor.
>
> ``` xojo
> Me.AcceptPictureDrop
> Me.AcceptFileDrop("image/jpeg")
> ```

<div id="desktophtmlviewer.acceptpicturedrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AcceptPictureDrop

**AcceptPictureDrop**

> Permits pictures to be dropped on the control.
>
> If a control should accept pictures in a drag and drop, then AcceptPictureDrop needs to be called prior to the drop. Typically, it is in the Opening event of the control itself. For example, the line:
>
> ``` xojo
> Me.AcceptPictureDrop
> ```
>
> in the Opening event of the control that will receive the dragged pictures is needed. When the picture is dropped, the `DropObject<desktopuicontrol.dropobject>` event is called and this is where you will put your code to handle the drop.
>
> Opening Event:
>
> ``` xojo
> Me.AcceptPictureDrop
> ```
>
> DropObject Event:
>
> ``` xojo
> If obj.PictureAvailable Then
>     Me.Backdrop = obj.Picture
> End If
> ```

<div id="desktophtmlviewer.acceptrawdatadrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AcceptRawDataDrop

**AcceptRawDataDrop**(Type As `String</api/data_types/string>`)

> Permits data (of the Type specified) to be dropped on the control.
>
> The following specfies a generic file type defined in the File Type Sets editor.
>
> ``` xojo
> Me.AcceptRawDataDrop("????")
> ```

<div id="desktophtmlviewer.accepttextdrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.AcceptTextDrop

**AcceptTextDrop**

> Permits text to be dropped on the control.
>
> This line in the Opening event of a control that can accept dragged text.
>
> ``` xojo
> Me.AcceptTextDrop
> ```

<div id="desktophtmlviewer.cancel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Cancel

**Cancel**

> Cancels any current operations.
>
> ``` xojo
> Me.Cancel
> ```

<div id="desktophtmlviewer.close">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Close

**Close**

> Closes a control.
>
> Closing a control permanently removes the control from memory, making it impossible to access. You can close both non-indexed controls and indexed controls. When you close an indexed control, the indexes for the remaining controls will shift downward so that the indexes start with zero and are consecutive.
>
> The following code closes the control. When this is executed from a visible control, the control disappears from the window.
>
> ``` xojo
> Me.Close
> ```

<div id="desktophtmlviewer.drawinto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.DrawInto

**DrawInto**(g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

> Draws the contents of the control into the specified `Graphics</api/graphics/graphics>` context. The parameters *x* and *y* are the coordinates of the top, left corner.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> Although the <span class="title-ref">DesktopHTMLViewer</span> has this method, it's not supported.
>
> </div>

<div id="desktophtmlviewer.executejavascript">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.ExecuteJavaScript

**ExecuteJavaScript**(js As `String</api/data_types/string>`)

> Asynchronously executes the passed JavaScript in the context of the currently loaded page.
>
> Attempting to execute JavaScript before the page finishes loading (or if no page is loaded) is undefined and is unlikely to work.
>
> In order to call JavaScript on Windows, a document must already be loaded into the HTMLViewer. If no document is loaded, an `HTMLViewerException</api/exceptions/htmlviewerexception>` is raised.
>
> This code will populate the search field on the wikipedia page (assuming it was previously loaded):
>
> ``` xojo
> Var jsSrc As String
> jsSrc = "document.forms[0].elements['search'].value=""xojo"";"
> HTMLViewer1.ExecuteJavaScript(jsSrc)
> ```
>
> This code writes text to the HTML document:
>
> ``` xojo
> Var this As String
> this = "document.writeln(""hello"");"
> HTMLViewer1.ExecuteJavaScript(this)
> ```

<div id="desktophtmlviewer.executejavascriptsync">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.ExecuteJavaScriptSync

**ExecuteJavaScriptSync**(js As `String</api/data_types/string>`) As `Variant</api/data_types/variant>`

> Synchronously executes the passed JavaScript in the context of the currently loaded page and returns the result. Only strings and numbers may be returned.
>
> Attempting to execute JavaScript before the page finishes loading (or if no page is loaded) is undefined and is unlikely to work.
>
> In order to call JavaScript on Windows, a document must already be loaded into the HTMLViewer. If no document is loaded, an `HTMLViewerException</api/exceptions/htmlviewerexception>` is raised.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On Windows when using WebView2, `executeInXojoSync` uses JavaScript Promises to simulate synchronous behavior. Your JavaScript code must use `await` when calling it. For example: `const result = await executeInXojoSync("addNumbers", 2, 3);`
>
> </div>

<div id="desktophtmlviewer.goback">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.GoBack

**GoBack**

> Navigates to the prior page.
>
> On a back button Pressed event handler, you can write:
>
> ``` xojo
> HTMLViewer1.GoBack
> ```

<div id="desktophtmlviewer.goforward">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.GoForward

**GoForward**

> Navigates to the next page.
>
> On a forward button Pressed event handler, you can write:
>
> ``` xojo
> HTMLViewer1.GoForward
> ```

<div id="desktophtmlviewer.isavailable">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.IsAvailable

**IsAvailable** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, it indicates that the required support libraries required by the control were loaded.
>
> This property is read-only.
>
> The engine behind <span class="title-ref">DesktopHTMLViewer</span> is WebKit on macOS and Linux. On Windows, it uses either WebView2 or the Chromium Embedded Framework (CEF), depending on your build settings.
>
> This example in the Opening event handler calls the IsAvailable property prior to proceeding:
>
> ``` xojo
> If Me.IsAvailable Then
>     Me.LoadURL("http://www.wikipedia.org")
> End If
> ```

<div id="desktophtmlviewer.loadpage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LoadPage

**LoadPage**(source As `String</api/data_types/string>`, base As `FolderItem</api/files/folderitem>`)

> Loads the HTML in *source* into the HTMLViewer.
>
> Any links or temporary files will be resolved relative to the passed *base* `FolderItem</api/files/folderitem>`.
>
> In this example, the raw HTML is in a `TextArea</api/user_interface/desktop/desktoptextarea>`:
>
> ``` xojo
> Var f As FolderItem = FolderItem.TemporaryFile.Child("index.html")
> HTMLViewer1.LoadPage(TextArea1.Text, f)
> ```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LoadPage

**LoadPage**(page As `FolderItem</api/files/folderitem>`)

> Loads the supplied *page* into the HTMLViewer. *page* must be an actual file and not a folder.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> While this should work on Windows, there may be some limitations due to CEF security. These limitations do not apply when using WebView2.
>
> </div>
>
> This example loads an HTML file from disk. The file type has been added using the File Types Set Editor:
>
> ``` xojo
> Var f As FolderItem
>
> f = FolderItem.ShowOpenFileDialog("text/html")
> If f <> Nil Then
>   HTMLViewer1.LoadPage(f)
> End If
> ```

<div id="desktophtmlviewer.loadurl">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.LoadURL

**LoadURL**(URL As `String</api/data_types/string>`)

> Loads the passed HTTP URL. Any protocol other than HTTP may or may not work as that is dependent on operating system behavior.
>
> On macOS, you need to ensure the URL is prefixed with "<http://>" or "<https://>" in order for it to load.
>
> This example loads a URL entered by the user in a `DesktopTextField</api/user_interface/desktop/desktoptextfield>`:
>
> ``` xojo
> Var url As String = URLField.Text
> If url.Left(7) <> "http://" Then url = "http://" + url
> HtmlViewer1.LoadURL(url)
> ```

<div id="desktophtmlviewer.print">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Print

**Print**(showPrintDialog As `Boolean</api/data_types/boolean>` = `True</api/language/true>`)

> Prints the contents of the HTMLViewer. On Linux, this requires WebKit 1.1.5 or newer.
>
> This example prints the current page.
>
> ``` xojo
> HTMLViewer1.Print
> ```

<div id="desktophtmlviewer.printtopdf">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.PrintToPDF

**PrintToPDF**(file As `FolderItem</api/files/folderitem>`)

> Prints the contents of the HTMLViewer as a PDF to the *file* passed.
>
> This example prints the current page to a PDF file.
>
> ``` xojo
> Var f as FolderItem = SpecialFolder.Desktop.Child("MyReport.PDF")
> HTMLViewer1.PrintToPDF(f)
> ```
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> If content is being loaded dynamically when the part of the page becomes visible, it will not appear in the PDF document unless it has been exposed on screen as it will not have loaded yet.
>
> </div>

<div id="desktophtmlviewer.refresh">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Refresh

**Refresh**(immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Redraws the portion specified of the contents of the control the next time the OS redraws the control or immediately if `True</api/language/true>` is passed.
>
> If you are calling this so frequently that you experience a slowdown in your code, pass `True</api/language/true>` for the immediately parameter.
>
> Calling this method causes the Render event to fire.
>
> Refresh the entire area immediately:
>
> ``` xojo
> Me.Refresh(True)
> ```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Refresh

**Refresh**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Redraws the portion specified of the contents of the control the next time the OS redraws the control or immediately if `True</api/language/true>` is passed.
>
> Refresh a portion of the area the next time the OS redraws the control:
>
> ``` xojo
> Me.Refresh(100, 150, 200, 300)
> ```

<div id="desktophtmlviewer.setfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.SetFocus

**SetFocus**

> If applicable, sets the focus to the DesktopUIControl. KeyDown events are directed to the control.
>
> If the control cannot get the focus on the platform on which the application is running, SetFocus does nothing. The SetFocus method of the `DesktopWindow</api/user_interface/desktop/desktopwindow>` class or the `ClearFocus</api/user_interface/desktop/clearfocus>` method can be used to remove the focus from the control that currently has the focus, leaving no control with the focus.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On macOS, you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.
>
> </div>
>
> The following example in the Opening event sets the focus to the that control. If another control has the focus when this line is executed, then the user sees this control gets the focus.
>
> ``` xojo
> Me.SetFocus
> ```

<div id="desktophtmlviewer.zoomtextin">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.ZoomTextIn

**ZoomTextIn**

> Augments the size of the text used to display the HTML page content. You can use ZoomTextIn several times.
>
> The reverse action is achieved with the `ZoomTextOut<desktophtmlviewer.zoomtextout>` method.
>
> This example is the Pressed event of a `DesktopSegmentedButton</api/user_interface/desktop/desktopsegmentedbutton>`:
>
> ``` xojo
> If segmentIndex = 0 Then
>   HtmlViewer1.ZoomTextIn
> ElseIf segmentIndex = 1 Then
>   HtmlViewer1.ZoomTextOut
> End If
> ```
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On Windows, ZoomTextIn affects all DesktopHTMLViewers displaying content from the same domain.
>
> </div>

<div id="desktophtmlviewer.zoomtextout">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.ZoomTextOut

**ZoomTextOut**

> Reduces the size of the text used to display the HTML page content. You can use ZoomTextOut several times.
>
> The reverse action is achieved with the `ZoomTextIn<desktophtmlviewer.zoomtextin>` method.
>
> This example is the Pressed event of a `DesktopSegmentedButton</api/user_interface/desktop/desktopsegmentedbutton>`:
>
> ``` xojo
> If itemIndex = 0 Then
>   HtmlViewer1.ZoomTextIn
> ElseIf itemIndex = 1 Then
>   HtmlViewer1.ZoomTextOut
> End If
> ```
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On Windows, ZoomTextOut affects all DesktopHTMLViewers displaying content from the same domain.
>
> </div>

## Event descriptions

<div id="desktophtmlviewer.cancelload">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.CancelLoad

**CancelLoad**(URL As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` to cancel loading the page.

<div id="desktophtmlviewer.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Closing

**Closing**

> The control is closing.

<div id="desktophtmlviewer.documentbegin">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.DocumentBegin

**DocumentBegin**(URL As `String</api/data_types/string>`)

> Fires when the HTML page is starting to load.

<div id="desktophtmlviewer.documentcomplete">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.DocumentComplete

**DocumentComplete**(URL As `String</api/data_types/string>`)

> Called when the HTML page is finished loading.

<div id="desktophtmlviewer.documentprogresschanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.DocumentProgressChanged

**DocumentProgressChanged**(URL As `String</api/data_types/string>`, percentageComplete As `Integer</api/data_types/integer>`)

> Fires when the progress has been updated. If *percentageComplete* is -1, the percentage cannot be determined.

<div id="desktophtmlviewer.error">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Error

**Error**(errorNumber As `Integer</api/data_types/integer>`, errorMessage As `String</api/data_types/string>`)

> Fires when an error occurs.
>
> The errors you receive are the [standard HTTP Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes).

<div id="desktophtmlviewer.focuslost">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.FocusLost

**FocusLost**

> The `control</api/user_interface/desktop/desktopuicontrol>` has lost the focus.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On macOS, controls other than text fields and lists will accept and lose focus only if the full keyboard access option is enabled in System Preferences/Keyboard.
>
> </div>

<div id="desktophtmlviewer.focusreceived">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.FocusReceived

**FocusReceived**

> The `control</api/user_interface/desktop/desktopuicontrol>` has received the focus and has a selection rectangle around it.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On macOS, controls other than text fields and lists will accept focus only if the full keyboard access option is enabled in System Preferences/Keyboard.
>
> </div>

<div id="desktophtmlviewer.javascriptrequest">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.JavaScriptRequest

**JavaScriptRequest**(method As `String</api/data_types/string>`, parameters() As `Variant</api/data_types/variant>`) As String

> Called when a JavaScript executed via `ExecuteJavaScript<desktophtmlviewer.executejavascript>` or `ExecuteJavaScriptSync<desktophtmlviewer.executejavascriptsync>` calls ExecuteInXojo or ExecuteInXojoSync.
>
> A JavaScript executed via `ExecuteJavaScript<desktophtmlviewer.executejavascript>` or `ExecuteJavaScriptSync<desktophtmlviewer.executejavascriptsync>` can call **executeInXojo()** or **executeInXojoSync()** to pass data back to the HTMLViewer via this event. Both can be passed any number of parameters though the first parameter must be a string. For all subsequent parameters, only strings and numbers are supported. The executeInXojo() method is asynchronous and thus will not receive a value returned by this event. The executeInXojoSync() method is synchronous and thus should be called as a function as it will receive the value returned by this event.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On Windows when using WebView2, `executeInXojoSync` uses JavaScript Promises to simulate synchronous behavior. Your JavaScript code must use `await` when calling it. For example: `const result = await executeInXojoSync("addNumbers", 2, 3);`
>
> </div>

<div id="desktophtmlviewer.keydown">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.KeyDown

**KeyDown**(key As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> The user has pressed the *Key* passed while the `control</api/user_interface/desktop/desktopuicontrol>` has the focus.
>
> Returning `True</api/language/true>` prevents the KeyDown event on the parent control (usually the window) from executing. Returning `False</api/language/false>` results in the execution of the KeyDown event of the parent control.

<div id="desktophtmlviewer.keyup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.KeyUp

**KeyUp**(key As `String</api/data_types/string>`)

> Fires when the passed *Key* is released in the control that has the focus.
>
> It is not guaranteed to be the same key that received the KeyDown event.

<div id="desktophtmlviewer.newwindow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.NewWindow

**NewWindow**(URL As `String</api/data_types/string>`) As `HTMLViewer</api/user_interface/desktop/desktophtmlviewer>`

> Called when the HTML on page requests that a URL be opened in a new HTML viewer (a new window or tab depending how the user chooses to open it).
>
> Returns a new instance of an **HTMLViewer** to load the page in that viewer or `Return</api/language/return>` `Nil</api/language/nil>` when you do not want to allow the window to open.

<div id="desktophtmlviewer.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.Opening

**Opening**

> The control is about to be displayed. Use this event to initialize a control.
>
> The Opening event is called after the Constructor.
>
> Be warned that initializing control property values using the Constructor instead of the Opening event may result in those property values being overwritten by what is set in the Inspector. For best results, use the Opening event for control initialization rather than the control Constructor.
>
> If the control is supposed to handle drag and drop, you need to tell it which type of item it needs to be able to handle. The following example informs the control that pictures and files can be dropped on it. The type of the file it needs to support is specified via the File Types Editor.
>
> ``` xojo
> Sub Opening()
>   Me.AcceptPictureDrop
>   Me.AcceptFileDrop("JPEG")
> End Sub
> ```

<div id="desktophtmlviewer.printcomplete">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.PrintComplete

**PrintComplete**

> Printing has completed successfully.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> On Windows, this event works when using `PrintToPDF<desktophtmlviewer.printtopdf>`, but not with regular printing.
>
> </div>

<div id="desktophtmlviewer.printerror">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.PrintError

**PrintError**(error as `RuntimeException</api/exceptions/runtimeexception>`)

> Printing has failed either because it was cancelled by the user or an error of some kind occured.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> On Windows, this event works when using `PrintToPDF<desktophtmlviewer.printtopdf>`, but not with regular printing.
>
> </div>

<div id="desktophtmlviewer.securitychanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.SecurityChanged

**SecurityChanged**(isSecure As `Boolean</api/data_types/boolean>`)

> Fires when the document's security has changed. For example, entering a secure web site will cause this event to fire.
>
> This event is only called on Microsoft Windows.

<div id="desktophtmlviewer.statuschanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.StatusChanged

**StatusChanged**(newStatus As `String</api/data_types/string>`)

> Fires when the Status text has changed for the window.
>
> Due to changes made to the CEF3 library (Chromium Embedded Framework) this event is not called on Windows when using CEF. This event is also not called when using WebView2.

<div id="desktophtmlviewer.titlechanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DesktopHTMLViewer.TitleChanged

**TitleChanged**(newTitle As `String</api/data_types/string>`)

> Fires when the Title of the Web page has been determined or has changed.

## Notes

On macOS, the HTMLViewer supports getting and setting a custom user agent string and increasing or decreasing the font size.

WebKit is used for all desktop HTML rendering on macOS and Linux. On Windows, <span class="title-ref">DesktopHTMLViewer</span> uses WebView2 when the WinUI Build Setting is enabled, or when the **HTMLViewer uses WebView2** option is enabled in the Windows Advanced Build Settings. Otherwise, it uses the Chromium Embedded Framework (CEF).

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Exchanging data with javascript

A JavaScript executed via `ExecuteJavaScript<desktophtmlviewer.executejavascript>` or `ExecuteJavaScriptSync<desktophtmlviewer.executejavascriptsync>` can call executeInXojo() or executeInXojoSync() to pass data back to the HTMLViewer via the `JavaScriptRequest<desktophtmlviewer.javascriptrequest>` event. Both can be passed any number of parameters though the first parameter must be a string. For all subsequent parameters, only strings and numbers are supported. The executeInXojo() method is asynchronous and thus will not receive a value returned by the `JavaScriptRequest<desktophtmlviewer.javascriptrequest>` event. The executeInXojoSync() method is synchronous and thus should be called as a function as it will receive the value returned by the `JavaScriptRequest<desktophtmlviewer.javascriptrequest>` event.

On Windows when using WebView2, executeInXojoSync() uses JavaScript Promises to simulate synchronous behavior. Your JavaScript code must use `await` when calling it. For example: `const result = await executeInXojoSync("addNumbers", 2, 3);`

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### App transport security

Starting with MacOS 10.11 and Xojo 2018r4, your apps have to use secure "https" connections or you will get this error: "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection". You can work around this by providing a plist with your app to indicate what non-secure URLs you are using. More information is available in the `Using Non-Secure URLs on macOS and iOS</topics/communication/internet/using_non-secure_urls_on_macos_and_ios>` topic.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Windows HTML rendering backends

On Windows, <span class="title-ref">DesktopHTMLViewer</span> supports two rendering backends: WebView2 and the Chromium Embedded Framework (CEF).

WebView2 is always used when the WinUI Build Setting is enabled. For non-WinUI projects, you can enable WebView2 via the **HTMLViewer uses WebView2** option in the Windows Advanced Build Settings. When neither condition applies, CEF is used.

To make plugins available to the <span class="title-ref">DesktopHTMLViewer</span> on Windows when using CEF, create a folder called WebKitPlugins within your Libs folder in your application folder and place the plugins you need there.

When using CEF, the `Handle<desktopcontrol.handle>` property returns a pointer to the `cef_browser_t` struct.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Linux support

If it is available, the Linux HTMLViewer uses WebKit (libwebkitgtk version 3).

Refer to the `System Requirements for current release</resources/system_requirements_for_current_release/64-bit_configuration_for_running_32-bit_apps>` section for commands that you can use to install libwebkitgtk v3 on various Linux distributions.

On Linux, HTMLViewer.Handle returns the GtkScrolledWindow that hosts the WebKitWebView control (please refer to the [WebKitGTK site](http://webkitgtk.org) for information on how to use this system control).

### Camera and microphone access

When a page is displayed that accesses the camera and/or microphone, they will automatically be accessible on Linux and Windows. However, for them to be accessible on macOS, your app must include an info.plist file with the following two entries:

``` 
<key>NSCameraUsageDescription</key><string>Camera description.</string>
<key>NSMicrophoneUsageDescription</key><string>Microphone description.</string>
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#### Drawing issue

The <span class="title-ref">DesktopHTMLViewer</span> may not draw its contents properly when using it on Linux on some <span class="title-ref">hardware</span> configurations. Should this happen, turning off <span class="title-ref">hardware</span> acceleration will resolve the issue.

To turn off <span class="title-ref">hardware</span> acceleration in the App.Opening event, use the following code:

``` xojo
System.EnvironmentVariable("WEBKIT_HARDWARE_ACCELERATION") = "OFF"
```

<div class="note">

<div class="title">

Note

</div>

When running your Xojo app on Linux distros running Wayland the drawing issue above is far more common. Because of this, <span class="title-ref">hardware</span> acceleration is off by default. You can turn it back on if you wish to test your app to see if it has this drawing issue or not.

</div>

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Sample code

``` xojo
Var s As String = HTMLViewer1.ExecuteJavaScriptSync("document.documentElement.innerHTML;")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Create a window with a large <span class="title-ref">DesktopHTMLViewer</span> control. Set its LockLeft, LockTop, LockRight, and LockBottom properties so that it resizes as the user resizes the window. Use a `DesktopTextField</api/user_interface/desktop/desktoptextfield>` as the URL entry area and a `DesktopButton</api/user_interface/desktop/desktopbutton>` as the browser's Go button. That is, the user clicks Go to display the URL entered into the `DesktopTextField</api/user_interface/desktop/desktoptextfield>`.

In this example, the HTMLViewer is named “HTML”. The following code is in the Pressed event of the `DesktopButton</api/user_interface/desktop/desktopbutton>`:

``` xojo
HTML.LoadURL(TextField.Text)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You can use a `DesktopProgressBar</api/user_interface/desktop/desktopprogressbar>` to indicate that the web page is loading. In the <span class="title-ref">DesktopHTMLViewer</span>'s DocumentBegin event, initialize and show the `DesktopProgressBar</api/user_interface/desktop/desktopprogressbar>` with the code:

``` xojo
ProgressBar1.Value = 0
ProgressBar1.Visible = True
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In the DocumentProgressChanged event, increment the value of the `DesktopProgressBar</api/user_interface/desktop/desktopprogressbar>`. This event handler is passed the value of PercentageComplete (0 to 100).

``` xojo
If percentageComplete = -1 Then ' if it cannot be determined
  ProgressBar1.MaximumValue = 0 ' display indeterminate progress
Else
  ProgressBar1.MaximumValue = 100
End if

ProgressBar1.Value = percentageComplete
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In the DocumentComplete event handler, hide the ProgressBar with the line:

``` xojo
ProgressBar1.Visible = False
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When the title of the web page has been received, you can display it in the window's Title bar using the <span class="title-ref">DesktopHTMLViewer</span>'s TitleChanged event. It is passed the new title in the `String</api/data_types/string>` parameter newTitle. Update the window title with the line:

``` xojo
Title = newTitle
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Use a second `DesktopTextField</api/user_interface/desktop/desktoptextfield>` to display the status of the load process. In the HTMLViewer's StatusChanged event handler, set the value of this `DesktopTextField</api/user_interface/desktop/desktoptextfield>`. This event handler is passed the current status in the `String</api/data_types/string>` parameter, NewStatus. Display this string with the following line in the StatusChanged event:

``` xojo
TextField1.Text = NewStatus
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If a new browser window is supposed to open, you need to insert some code to handle this event. For example, the user clicks a link that is supposed to display the new page in another window. Use the NewWindow event handler to create the window. The following code assumes that the browser is contained in a window called MainWindow and the window contains an HTMLBrowser named HTMLBrowser1.

``` xojo
Var w As New MainWindow

Title = "New Window" ' Title property of new window
w.Show

Return w.HTMLViewer1
```

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div class="seealso">

`DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` parent class; `URLConnection</api/networking/urlconnection>` class

</div>
