<div class="meta" robots="noindex">

</div>

Class

# HTMLViewer (deprecated)

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r3. Please use `DesktopHTMLViewer</api/user_interface/desktop/desktophtmlviewer>` as a replacement.

</div>

## Description

Renders HTML and provides basic navigation features.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                  | Type                                                   | Read-Only | Shared |
|-------------------------------------------------------|--------------------------------------------------------|-----------|--------|
| `Active<htmlviewer.active>`                           | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `AllowAutoDeactivate<htmlviewer.allowautodeactivate>` | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowTabStop<htmlviewer.allowtabstop>`               | `Boolean</api/data_types/boolean>`                     |           |        |
| `CanGoBack<htmlviewer.cangoback>`                     | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `CanGoForward<htmlviewer.cangoforward>`               | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `Enabled<htmlviewer.enabled>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `Handle<htmlviewer.handle>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Height<htmlviewer.height>`                           | `Integer</api/data_types/integer>`                     |           |        |
| `Index<htmlviewer.index>`                             | `Integer</api/data_types/integer>`                     | ✓         |        |
| `IsAvailable<htmlviewer.isavailable>`                 | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `Left<htmlviewer.left>`                               | `Integer</api/data_types/integer>`                     |           |        |
| `LockBottom<htmlviewer.lockbottom>`                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockLeft<htmlviewer.lockleft>`                       | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockRight<htmlviewer.lockright>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockTop<htmlviewer.locktop>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `MouseCursor<htmlviewer.mousecursor>`                 | `MouseCursor</api/user_interface/desktop/mousecursor>` |           |        |
| `MouseX<htmlviewer.mousex>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `MouseY<htmlviewer.mousey>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Name<htmlviewer.name>`                               | `String</api/data_types/string>`                       | ✓         |        |
| `PanelIndex<htmlviewer.panelindex>`                   | `Integer</api/data_types/integer>`                     |           |        |
| `Parent<htmlviewer.parent>`                           | `Control</api/deprecated/control>`                     |           |        |
| `Renderer<htmlviewer.renderer>`                       | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Scope<htmlviewer.scope>`                             | `Integer</api/data_types/integer>`                     | ✓         |        |
| `TabIndex<htmlviewer.tabindex>`                       | `Integer</api/data_types/integer>`                     |           |        |
| `Tooltip<htmlviewer.tooltip>`                         | `String</api/data_types/string>`                       |           |        |
| `Top<htmlviewer.top>`                                 | `Integer</api/data_types/integer>`                     |           |        |
| `Transparent<htmlviewer.transparent>`                 | `Boolean</api/data_types/boolean>`                     |           |        |
| `TrueWindow<htmlviewer.truewindow>`                   | `Window</api/deprecated/window>`                       | ✓         |        |
| `UserAgent<htmlviewer.useragent>`                     | `String</api/data_types/string>`                       |           |        |
| `UseSandbox<htmlviewer.usesandbox>`                   | `String</api/data_types/string>`                       |           |        |
| `Visible<htmlviewer.visible>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `Width<htmlviewer.width>`                             | `Integer</api/data_types/integer>`                     |           |        |
| `Window<htmlviewer.window>`                           | `Window</api/deprecated/window>`                       | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                      | Parameters                                                                                                                | Returns                            | Shared |
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AcceptFileDrop<htmlviewer.acceptfiledrop>`               | FileType As `String</api/data_types/string>`                                                                              |                                    |        |
| `AcceptPictureDrop<htmlviewer.acceptpicturedrop>`         |                                                                                                                           |                                    |        |
| `AcceptRawDataDrop<htmlviewer.acceptrawdatadrop>`         | Type As `String</api/data_types/string>`                                                                                  |                                    |        |
| `AcceptTextDrop<htmlviewer.accepttextdrop>`               |                                                                                                                           |                                    |        |
| `Cancel<htmlviewer.cancel>`                               |                                                                                                                           |                                    |        |
| `Close<htmlviewer.close_method>`                          |                                                                                                                           |                                    |        |
| `DrawInto<htmlviewer.drawinto>`                           | g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>` |                                    |        |
| `ExecuteJavaScript<htmlviewer.executejavascript>`         | js As `String</api/data_types/string>`                                                                                    |                                    |        |
| `ExecuteJavaScriptSync<htmlviewer.executejavascriptsync>` | js As `String</api/data_types/string>`                                                                                    | `Variant</api/data_types/variant>` |        |
| `GoBack<htmlviewer.goback>`                               |                                                                                                                           |                                    |        |
| `GoForward<htmlviewer.goforward>`                         |                                                                                                                           |                                    |        |
| `Invalidate<htmlviewer.invalidate>`                       | \[EraseBackground As `Boolean</api/data_types/boolean>`\]                                                                 |                                    |        |
| `LoadPage<htmlviewer.loadpage>`                           | Source As `String</api/data_types/string>`, RelativeTo As `FolderItem</api/files/folderitem>`                             |                                    |        |
|                                                           | File As `FolderItem</api/files/folderitem>`                                                                               |                                    |        |
| `LoadURL<htmlviewer.loadurl>`                             | URL As `String</api/data_types/string>`                                                                                   |                                    |        |
| `Print<htmlviewer.print>`                                 | showPrintDialog As `Boolean</api/data_types/boolean>` = `True</api/language/true>`                                        |                                    |        |
| `Refresh<htmlviewer.refresh>`                             | eraseBackground As `Boolean</api/data_types/boolean>`                                                                     |                                    |        |
| `SetFocus<htmlviewer.setfocus>`                           |                                                                                                                           |                                    |        |
| `ZoomTextIn<htmlviewer.zoomtextin>`                       |                                                                                                                           |                                    |        |
| `ZoomTextOut<htmlviewer.zoomtextout>`                     |                                                                                                                           |                                    |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                          | Parameters                                                                                          | Returns                            |
|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|------------------------------------|
| `CancelLoad<htmlviewer.cancelload>`                           | URL As `String</api/data_types/string>`                                                             | `Boolean</api/data_types/boolean>` |
| `Close<htmlviewer.close_event>`                               |                                                                                                     |                                    |
| `DocumentBegin<htmlviewer.documentbegin>`                     | URL As `String</api/data_types/string>`                                                             |                                    |
| `DocumentComplete<htmlviewer.documentcomplete>`               | URL As `String</api/data_types/string>`                                                             |                                    |
| `DocumentProgressChanged<htmlviewer.documentprogresschanged>` | URL As `String</api/data_types/string>`, PercentageComplete As `Integer</api/data_types/integer>`   |                                    |
| `Error<htmlviewer.error>`                                     | ErrorNumber As `Integer</api/data_types/integer>`, ErrorMessage As `String</api/data_types/string>` |                                    |
| `JavaScriptRequest<htmlviewer.javascriptrequest>`             | method As `String</api/data_types/string>`, parameters() As `Variant</api/data_types/variant>`      | String                             |
| `KeyDown<htmlviewer.keydown>`                                 | Key As `String</api/data_types/string>`                                                             | `Boolean</api/data_types/boolean>` |
| `KeyUp<htmlviewer.keyup>`                                     | Key As `String</api/data_types/string>`                                                             |                                    |
| `NewWindow<htmlviewer.newwindow>`                             | url As <span class="title-ref">String\</api/data_types/string\></span>                              | HTMLViewer                         |
| `Open<htmlviewer.open>`                                       |                                                                                                     |                                    |
| `SecurityChanged<htmlviewer.securitychanged>`                 | IsSecure As `Boolean</api/data_types/boolean>`                                                      |                                    |
| `StatusChanged<htmlviewer.statuschanged>`                     | NewStatus As `String</api/data_types/string>`                                                       |                                    |
| `TitleChanged<htmlviewer.titlechanged>`                       | NewTitle As `String</api/data_types/string>`                                                        |                                    |

## Property descriptions

<div id="htmlviewer.active">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Active

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

Indicates whether the `RectControl</api/deprecated/rectcontrol>` is active.

This property is read-only.

Active is `False</api/language/false>` when the `RectControl</api/deprecated/rectcontrol>`'s window is not in the foreground. When a `Window</api/deprecated/window>` is deactivated, its controls are automatically deactivated unless `AutoDeactivate<rectcontrol.allowautodeactivate>` is set to `False</api/language/false>`.

<div id="htmlviewer.allowautodeactivate">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.allowtabstop">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.AllowTabStop

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

If `True</api/language/true>`, the **RectControl** 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 **RectControl** 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="htmlviewer.cangoback">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 `HTMLViewer<htmlviewer.goback>`.

This property is read-only.

This code in the `DocumentComplete<htmlviewer.documentcomplete>` event handler disables a Back button if there is no prior page:

``` xojo
BackButton.Enabled = Me.CanGoBack
```

<div id="htmlviewer.cangoforward">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 `HTMLViewer<htmlviewer.goforward>`.

This property is read-only.

This code in the `DocumentComplete<htmlviewer.documentcomplete>` event handler disables a Forward button if there is no next page:

``` xojo
ForwardButton.Enabled = Me.CanGoForward
```

<div id="htmlviewer.enabled">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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. Its caption is grayed out.

``` xojo
Me.Enabled = False
```

<div id="htmlviewer.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Handle

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

Returns a handle to the control.

This property is read-only.

For interfacing with Mac APIs using `` Declare</api/language/declare>`s, RectControl.Handle returns NSViews (except for :doc:`Toolbar</api/deprecated/toolbar> ``).

On Windows returns the HWND of the control.

On Linux it returns a GtkWidget.

The following gets a handle to the control.

``` xojo
Var i As Integer = Me.Handle
```

<div id="htmlviewer.height">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.index">

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

</div>

<div class="rst-class">

forsearch

</div>

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

This property is read-only.

The *control set* is often used to manage a group of RadioButtons since a single RadioButton in a window doesn't make much sense. Most typically, you create an instance of the RadioButton, assign 0 to its Index property, and then duplicate it. This increments the value of Index for each new instance but retain the original control's name.

To determine which RadioButton the user clicked, use the Action event handler of the control set. The parameter *Index* contains the value of Index for the RadioButton that was clicked. The event handler is this:

``` xojo
Sub Action(Index As Integer)
  Label1.Text = "You chose radio button " + index.ToString + "."
End Sub
```

To set a RadioButton in a control set, you use its *Index* property to refer to the RadioButton whose value you want to set. For example, the following line selects the second RadioButton from code:

``` xojo
RadioButton1(1).Value = True ' 0-based
```

<div id="htmlviewer.isavailable">

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

</div>

<div class="rst-class">

forsearch

</div>

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

On Windows, <span class="title-ref">HTMLViewer</span> uses Internet Explorer or WebKit (depending on the `Renderer<htmlviewer.renderer>` property), on macOS and Linux, it uses WebKit.

This example in the Open event handler calls the IsAvailable property prior to proceeding:

``` xojo
If Me.IsAvailable Then
  Me.LoadURL("http://www.wikipedia.org")
End If
```

<div id="htmlviewer.left">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Left

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

The left side of the control in local coordinates (relative to the window).

The following example moves the control 100 points from the left side of the window:

``` xojo
Me.Left = 150
```

<div id="htmlviewer.lockbottom">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.lockleft">

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

</div>

<div class="rst-class">

forsearch

</div>

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

Beginning with version 2009r5, 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="htmlviewer.lockright">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.locktop">

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

</div>

<div class="rst-class">

forsearch

</div>

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

Beginning with version 2009r5, 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="htmlviewer.mousecursor">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 `Window</api/deprecated/window>` 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 `Window</api/deprecated/window>`'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 Macintosh, you can also obtain a `MouseCursor</api/user_interface/desktop/mousecursor>` from a resource file.

This line in the Open event of the control sets the default cursor to the finger pointer.

``` xojo
Me.MouseCursor = System.Cursors.FingerPointer
```

<div id="htmlviewer.mousex">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.MouseX

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

The X coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the X-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseX)
```

<div id="htmlviewer.mousey">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.MouseY

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

The Y coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the Y-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseY)
```

<div id="htmlviewer.name">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.panelindex">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.PanelIndex

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

If the control has been placed on a `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` 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 `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` control, it returns the panel number. If the control is not on a `PagePanel</api/deprecated/pagepanel>` or `TabPanel</api/deprecated/tabpanel>`, 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 `PagePanel<pagepanel.selectedpanelindex>`.

This code displays the panel index of the control that is on the page.

``` xojo
Label3.Value = Str(Me.PanelIndex)
```

<div id="htmlviewer.parent">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Parent

**Parent** As `Control</api/deprecated/control>`

Used to get and set the control's parent control or window.

Returns `Nil</api/language/nil>` if the parent is the window. Assign `Nil</api/language/nil>` to make the control's parent the window, even if it is enclosed by another control. The child control's behavior in the IDE will reflect the parent's state. 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="htmlviewer.renderer">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Renderer

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

Used to specify the rendering engine used on Windows. Choices are Native (0) or WebKit (1). You can only set this property in the Inspector for the control.

This property is read-only.

The Native renderer is Internet Explorer.

Using WebKit on Windows adds the entire Chromium Embedded Framework 3 (CEF3) engine to your app, increasing its size by about 100MB.

If you need plugins when using WebKit, add them to the WebKitPlugins folder in the Libs folder for your application.

Setting this property at runtime has no effect.

When using Native, Windows uses an older version of the Internet Explorer rendering engine. You can switch to a more recent version specifically for your app with code like this:

``` xojo
Var reg As New RegistryItem("HKEY_CURRENT_USER\SOFTWARE\Microsoft")
reg = reg.AddFolder("Internet Explorer")
reg = reg.AddFolder("Main")
reg = reg.AddFolder("FeatureControl")
reg = reg.AddFolder("FEATURE_BROWSER_EMULATION")
reg.Value(App.ExecutableFile.Name) = &h2710 ' Use IE 11 renderer
```

<div id="htmlviewer.scope">

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

</div>

<div class="rst-class">

forsearch

</div>

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

If the Scope of a control is set to Private, it cannot be accessed from outside its parent window.

<div id="htmlviewer.tabindex">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.TabIndex

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

The **RectControl's** position in the Tab Order. It is 0-based. A TabIndex of 0 is the first **RectControl** to get the focus.

On the Mac you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.

This example sets the control's TabIndex.

``` xojo
Me.TabIndex = 2
```

<div id="htmlviewer.tooltip">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 `BevelButton</api/deprecated/bevelbutton>` that has an icon.

``` xojo
Me.CaptionAlignment = 0 ' left
Me.CaptionDelta = 10
Me.Tooltip = "Click to bark."

Me.Icon = Woof ' added to the project
Me.CaptionPosition = 2
```

<div id="htmlviewer.top">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Top

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

The top of the control in local coordinates (relative to the window).

This example sets the top of the control to 140 points from the top of the window:

``` xojo
Me.Top = 140
```

<div id="htmlviewer.transparent">

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

</div>

<div class="rst-class">

forsearch

</div>

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

For projects that were created prior to 2018r1, this property defaults to True to emulate previous behavior. Consider changing it to False to improve performance if you do not require transparency.

<div id="htmlviewer.truewindow">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.TrueWindow

**TrueWindow** As `Window</api/deprecated/window>`

Returns a reference to the actual enclosing `Window</api/deprecated/window>`.

This property is read-only.

TrueWindow walks up the window hierarchy and finds the actual enclosing window regardless of how deeply nested the `RectControl</api/deprecated/rectcontrol>` or `DesktopContainer</api/user_interface/desktop/desktopcontainer>` hierarchy is.

`Window</api/deprecated/window>` also has a TrueWindow property.

This example accesses the TrueWindow and displays its Title property in a `TextField</api/deprecated/textfield>`.

``` xojo
TextField1.Text = Me.TrueWindow.Title
```

<div id="htmlviewer.useragent">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.UserAgent

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

Supports getting and setting a custom user agent string.

UserAgent works on macOS and Windows (using the Native Renderer). Changing it has no effect on Linux or when on Windows using the WebKit `Renderer<htmlviewer.renderer>`.

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="htmlviewer.usesandbox">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.UseSandbox

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

If `True</api/language/true>`, the JavaScript (if any) embedded in the page being viewed in the <span class="title-ref">HTMLViewer</span> will be unable to access the <span class="title-ref">HTMLViewer</span>'s parent webpage.

<div id="htmlviewer.visible">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 in the DisclosureTriangle Action event handler displays or hides a ListBox on the window:

``` xojo
ListBox1.Value = Me.Visible
```

<div id="htmlviewer.width">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.window">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Window

**Window** As `Window</api/deprecated/window>`

The control's parent window.

This property is read-only.

This code gets the parent window's Title property.

``` xojo
TextField1.Text = Me.Window.Title
```

## Method descriptions

<div id="htmlviewer.acceptfiledrop">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 Open event of an `ImageWell</api/deprecated/imagewell>` 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")
```

To restrict file drops to just folders (and not files), you can put this code in the `DragEnter<rectcontrol.dragenter>` event:

``` xojo
If Not obj.FolderItem.IsFolder Then Return True
```

<div id="htmlviewer.acceptpicturedrop">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 Open event of the control itself. For example, the line:

``` xojo
Me.AcceptPictureDrop
```

in the Open event of the control that will receive the dragged pictures is needed. When the picture is dropped, the `DropObject<rectcontrol.dropobject>` event is called and this is where you will put your code to handle the drop.

Canvas.Open:

``` xojo
Me.AcceptPictureDrop
```

Canvas.DropObject:

``` xojo
If obj.PictureAvailable Then
  Me.Backdrop = obj.Picture
End If
```

<div id="htmlviewer.acceptrawdatadrop">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.accepttextdrop">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.AcceptTextDrop

**AcceptTextDrop**

Permits text to be dropped on the control.

This line in the Open event of a control that can accept dragged text.

``` xojo
Me.AcceptTextDrop
```

<div id="htmlviewer.cancel">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Cancel

**Cancel**

Cancels any current operations.

``` xojo
Me.Cancel
```

<div id="htmlviewer.close_method">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.drawinto">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 RectControl into the specified `Graphics</api/graphics/graphics>` context. The parameters *x* and *y* are the coordinates of the top, left corner.

This method does not work with <span class="title-ref">HTMLViewer</span> and `OpenGLSurface</api/deprecated/openglsurface>`.

This example draws the current control into the Graphics of a Picture and then displays it as the Backdrop of a Canvas:

``` xojo
Var p As New Picture(Me.Width, Me.Height)
Me.DrawInto(p.Graphics, 0, 0)
Canvas1.Backdrop = p
```

<div id="htmlviewer.executejavascript">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 using the Native renderer, a document must already be loaded into the <span class="title-ref">HTMLViewer</span>. 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="htmlviewer.executejavascriptsync">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 using the Native renderer, a document must already be loaded into the <span class="title-ref">HTMLViewer</span>. If no document is loaded, an `HTMLViewerException</api/exceptions/htmlviewerexception>` is raised.

<div id="htmlviewer.goback">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.GoBack

**GoBack**

Navigates to the prior page.

On a back button Action event handler, you can write:

``` xojo
HTMLViewer1.GoBack
```

<div id="htmlviewer.goforward">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.GoForward

**GoForward**

Navigates to the next page.

On a forward button Action event handler, you can write:

``` xojo
HTMLViewer1.GoForward
```

<div id="htmlviewer.invalidate">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Invalidate

**Invalidate**(\[EraseBackground As `Boolean</api/data_types/boolean>`\])

Similar to RefreshRect, but causes the specified region of the RectControl to be marked dirty and to be redrawn when the window contents need to be redrawn. The region to be redrawn is specified by the *X*, *Y*, *Width*, and *Height* parameters. This form of Invalidate was formerly called InvalidateRect.

The following code refreshes the control. EraseBackground defaults to `True</api/language/true>`.

``` xojo
Me.Invalidate(False)
```

<div id="htmlviewer.loadpage">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.LoadPage

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

Loads the the supplied *File* into the <span class="title-ref">HTMLViewer</span>. *File* must be an actual file and not a folder.

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

<div class="rst-class">

forsearch

</div>

HTMLViewer.LoadPage

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

Loads the the supplied *File* into the <span class="title-ref">HTMLViewer</span>. *File* must be an actual file and not a folder.

Any links will be resolved relative to the passed *RelativeTo* `FolderItem</api/files/folderitem>`.

On Windows, temporary files are created beside the passed *RelativeTo* FolderItem. If the temporary files cannot be created, then an exception error may be thrown. This can happen, for example, if you are trying to write to a read-only volume or you don't have write permissions.

In this example, the raw HTML is in a `TextArea</api/deprecated/textarea>`:

``` xojo
Var f As FolderItem = FolderItem.TemporaryFile
HTMLViewer1.LoadPage(TextArea1.Text, f)
```

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="htmlviewer.loadurl">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 `TextField</api/deprecated/textfield>`:

``` xojo
Var url As String = URLField.Value
If Left(url, 7) <> "http://" Then url = "http://" + url
HtmlViewer1.LoadURL(url)
```

<div id="htmlviewer.print">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Print

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

Prints the contents of the <span class="title-ref">HTMLViewer</span>. On Linux, this requires Webkit 1.1.5 or newer.

This example prints the current page.

``` xojo
HTMLViewer1.Print
```

<div id="htmlviewer.refresh">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Refresh

**Refresh**(eraseBackground As `Boolean</api/data_types/boolean>`)

Repaints the portion specified of the contents of the control immediately.

Calling this frequently can cause the code executing to slow down. It is often preferable to call `RectControl<rectcontrol.invalidate>` instead.

Refresh the entire area:

``` xojo
Me.Refresh(False)
```

Refresh a portion of the area:

``` xojo
Me.Refresh(100, 150, 200, 300)
```

<div id="htmlviewer.setfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.SetFocus

**SetFocus**

If applicable, sets the focus to the RectControl. 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 `Window</api/deprecated/window>` 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.

On the Mac you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.

The following example sets the focus to TextField1. If another control has the focus when this line is executed, then the user sees that TextField1 gets the focus.

``` xojo
TextField1.SetFocus
```

<div id="htmlviewer.zoomtextin">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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<htmlviewer.zoomtextout>` method.

This example is the Pressed event of a `SegmentedButton</api/deprecated/segmentedbutton>`:

``` xojo
If segmentIndex = 0 Then
  HtmlViewer1.ZoomTextIn
ElseIf segmentIndex = 1 Then
  HtmlViewer1.ZoomTextOut
End If
```

<div id="htmlviewer.zoomtextout">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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<htmlviewer.zoomtextin>` method.

This example is the Action event of a `SegmentedButton</api/deprecated/segmentedbutton>`:

``` xojo
If itemIndex = 0 Then
  HtmlViewer1.ZoomTextIn
ElseIf itemIndex = 1 Then
  HtmlViewer1.ZoomTextOut
End If
```

## Event descriptions

<div id="htmlviewer.cancelload">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.close_event">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Close

**Close**

The control is about to close.

<div id="htmlviewer.documentbegin">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.DocumentBegin

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

Fires when the HTML page is starting to load.

<div id="htmlviewer.documentcomplete">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.DocumentComplete

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

Called when the HTML page is finished loading.

<div id="htmlviewer.documentprogresschanged">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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="htmlviewer.error">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)

<div id="htmlviewer.javascriptrequest">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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<htmlviewer.executejavascript>` or `ExecuteJavaScriptSync<htmlviewer.executejavascriptsync>` calls ExecuteInXojo or ExecuteInXojoSync.

A JavaScript executed via `ExecuteJavaScript<htmlviewer.executejavascript>` or `ExecuteJavaScriptSync<htmlviewer.executejavascriptsync>` can call **executeInXojo()** or **executeInXojoSync()** to pass data back to the <span class="title-ref">HTMLViewer</span> 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 id="htmlviewer.keydown">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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/deprecated/rectcontrol>` has the focus.

How KeyDown works depends on the type of control.

**TextField and TextArea** Returning `True</api/language/true>` means the key is intercepted, preventing the key from actually reaching the control at all. This would be useful if you want to override the behavior of the tab key for example. Returning `False</api/language/false>` means the key reaches the control.

**All Other Controls** 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="htmlviewer.keyup">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.KeyUp

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

Fires when the passed *Key* is released in the RectControl that has the focus.

It is not guaranteed to be the same key that received the KeyDown event.

<div id="htmlviewer.newwindow">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.NewWindow

**NewWindow**(url As <span class="title-ref">String\</api/data_types/string\></span>) As HTMLViewer

Called when a new browser window is requested.

Returns a new instance of an <span class="title-ref">HTMLViewer</span> 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="htmlviewer.open">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.Open

**Open**

The control is about to be displayed. Use this event to initialize a control.

The Open event is called after the Constructor.

Be warned that initializing control property values using the Constructor instead of the Open event may result in those property values being overwritten by what is set in the Inspector. For best results, use the Open 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 Open()
  Me.AcceptPictureDrop
  Me.AcceptFileDrop("JPEG")
End Sub
```

<div id="htmlviewer.securitychanged">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 when using the Native renderer.

<div id="htmlviewer.statuschanged">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.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 Renderer = WebKit.

<div id="htmlviewer.titlechanged">

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

</div>

<div class="rst-class">

forsearch

</div>

HTMLViewer.TitleChanged

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

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

The renderer, which varies by OS, determines the maximum number of characters that are returned in *NewTitle*. You should test this in your projects to determine a maximum number of characters, keeping in mind that this could change at any time due to the underlying renderer and operating system.

## Notes

On macOS, the <span class="title-ref">HTMLViewer</span> supports getting and setting a custom user agent string and increasing or decreasing the font size.

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

### Exchanging data with javascript

A JavaScript executed via `ExecuteJavaScript<htmlviewer.executejavascript>` or `ExecuteJavaScriptSync<htmlviewer.executejavascriptsync>` can call executeInXojo() or executeInXojoSync() to pass data back to the <span class="title-ref">HTMLViewer</span> via the `JavaScriptRequest<htmlviewer.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<htmlviewer.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<htmlviewer.javascriptrequest>` event.

On Windows you need to use the WebKit rendering engine for executeInXojo() or executeInXojoSync() to work.

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

### 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. For more information: \* `Using Non-Secure URLs on macOS and iOS</topics/communication/internet/using_non-secure_urls_on_macos_and_ios>`

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

### Webkit on windows

You can use WebKit on Windows by setting the `Renderer<htmlviewer.renderer>` property to WebKit (1). Using WebKit on Windows adds the entire Chromium Embedded Framework 3 (CEF3) engine to your app, increasing its size by about 100MB.

To make plugins available to WebKit on Windows, create a folder called WebKitPlugins within your Libs folder in your application folder and place the plugins you need there.

When using WebKit on Windows, <span class="title-ref">HTMLViewer</span>.Handle returns a pointer to the cef_browser_t struct.

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

### Windows ie version

On Windows, the Native Renderer is probably using an older version of the Internet Explorer renderer. This may result in web pages that do not display or work as you expect. You can tell Windows to use a newer version of the IE rendering engine with a Registry setting. This is how you can change it using Xojo:

``` xojo
#If TargetWindows
  ' This code handles both 64 and 32-bit builds
  Var reg As New RegistryItem("HKEY_CURRENT_USER\SOFTWARE\Microsoft")
  reg = reg.AddFolder("Internet Explorer")
  reg = reg.AddFolder("Main")
  reg = reg.AddFolder("FeatureControl")
  reg = reg.AddFolder("FEATURE_BROWSER_EMULATION")

  ' Source MS documentation:  https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)
  reg.Value(App.ExecutableFile.Name) = CType(11000 , Int32)  
#EndIf
```

Another issue to keep in mind is if Internet Explorer 11 has the option "Display intranet sites in Compatibility View" selected in the "Compatibility View Settings" pane, then IE will most likely still render using IE7. If you control the source to the content you want to display, you can include this in the \<head\> section of the HTML document: \<pre class="code"\>\<meta http-equiv="X-UA-Compatible" content="IE=11"\>\</pre\>

And also use HTML5 DOCTYPE at the start of the document: \<pre class="code"\>\<!DOCTYPE html\>\</pre\>

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

### Windows performance

On Windows, the Native Renderer [might not use the GPU by default](https://msdn.microsoft.com/en-us/library/ee330731(v=vs.85).aspx), which may result in slower rendering speeds depending on what you are displaying. You can enable it via the Registry:

``` xojo
Var reg As New RegistryItem("HKEY_CURRENT_USER\SOFTWARE\Microsoft")
reg = reg.AddFolder("Internet Explorer")
reg = reg.AddFolder("Main")
reg = reg.AddFolder("FeatureControl")
reg = reg.AddFolder("FEATURE_GPU_RENDERING")
reg.Value(App.ExecutableFile.Name) = 1
```

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

### Linux support

If it is available, the Linux <span class="title-ref">HTMLViewer</span> 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, <span class="title-ref">HTMLViewer</span>.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).

## Sample code

To implement a simple web browser, create a window with a large HTML Viewer control. Set its LockLeft, LockTop, LockRight, and LockBottom properties so that it resizes as the user resizes the window. Use a `TextField</api/deprecated/textfield>` as the URL entry area and a `PushButton</api/deprecated/pushbutton>` as the browser's Go button. That is, the user clicks Go to display the URL entered into the `TextField</api/deprecated/textfield>`.

In this example, the <span class="title-ref">HTMLViewer</span> is named “HTML”. The following code is in the Action event of the `PushButton</api/deprecated/pushbutton>`:

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

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

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

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

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

In the DocumentProgressChanged event, increment the value of the `ProgressBar</api/deprecated/progressbar>`. This event handler is passed the value of PercentageComplete (0 to 100).

``` xojo
If percentageComplete = -1 Then ' if it cannot be determined
  ProgressBar1.Maximum = 0 ' display indeterminate progress
Else
  ProgressBar1.Maximum = 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">HTMLViewer</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 `TextField</api/deprecated/textfield>` to display the status of the load process. In the <span class="title-ref">HTMLViewer</span>'s StatusChanged event handler, set the value of this `TextField</api/deprecated/textfield>`. 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.Text3 = 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.

``` xojo
Var w As New MainWindow
Title = "New Window" //Title property of new window
w.Show
Return w.HTML
```

## Compatibility

All project types on all supported operating systems.

## See also

`RectControl</api/deprecated/rectcontrol>` parent class; `URLConnection</api/networking/urlconnection>` and `URLConnection</api/networking/urlconnection>` classes
