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

</div>

Class

# iOSHTMLViewer

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `MobileHTMLViewer</api/user_interface/mobile/mobilehtmlviewer>` as a replacement.

</div>

## Description

A scrollable HTML viewer control.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                   | Type                                     | Read-Only | Shared |
|--------------------------------------------------------|------------------------------------------|-----------|--------|
| `AccessibilityHint<ioshtmlviewer.accessibilityhint>`   | `Text</api/deprecated/text>`             |           |        |
| `AccessibilityLabel<ioshtmlviewer.accessibilitylabel>` | `Text</api/deprecated/text>`             |           |        |
| `Height<ioshtmlviewer.height>`                         | `Double</api/data_types/double>`         | ✓         |        |
| `Left<ioshtmlviewer.left>`                             | `Double</api/data_types/double>`         | ✓         |        |
| `Name<ioshtmlviewer.name>`                             | `Text</api/deprecated/text>`             | ✓         |        |
| `Parent<ioshtmlviewer.parent>`                         | `iOSControl</api/deprecated/ioscontrol>` | ✓         |        |
| `Top<ioshtmlviewer.top>`                               | `Double</api/data_types/double>`         | ✓         |        |
| `Visible<ioshtmlviewer.visible>`                       | `Boolean</api/data_types/boolean>`       |           |        |
| `Width<ioshtmlviewer.width>`                           | `Double</api/data_types/double>`         | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                               | Parameters                                                         | Returns                                                   | Shared |
|----------------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------|--------|
| `AddConstraint<ioshtmlviewer.addconstraint>`       | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `AddControl<ioshtmlviewer.addcontrol>`             | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `Control<ioshtmlviewer.control>`                   | index As `Integer</api/data_types/integer>`                        | `MobileControl</api/user_interface/mobile/mobilecontrol>` |        |
| `ControlCount<ioshtmlviewer.controlcount>`         |                                                                    | `Integer</api/data_types/integer>`                        |        |
| `Handle<ioshtmlviewer.handle>`                     |                                                                    | `Ptr</api/data_types/additional_types/ptr>`               |        |
| `Invalidate<ioshtmlviewer.invalidate>`             |                                                                    |                                                           |        |
| `LoadURL<ioshtmlviewer.loadurl>`                   | url As `String</api/data_types/string>`                            |                                                           |        |
| `RemoveConstraint<ioshtmlviewer.removeconstraint>` | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `RemoveControl<ioshtmlviewer.removecontrol>`       | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `SetTintColor<ioshtmlviewer.settintcolor>`         | value As `Color</api/data_types/color>`                            |                                                           |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                         | Parameters | Returns |
|------------------------------|------------|---------|
| `Close<ioshtmlviewer.close>` |            |         |
| `Open<ioshtmlviewer.open>`   |            |         |

## Property descriptions

<div id="ioshtmlviewer.accessibilityhint">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.AccessibilityHint

**AccessibilityHint** As `Text</api/deprecated/text>`

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityHint = "Click to calculate the value and display the next view."
```

<div id="ioshtmlviewer.accessibilitylabel">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.AccessibilityLabel

**AccessibilityLabel** As `Text</api/deprecated/text>`

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityLabel = "Calculate the value."
```

<div id="ioshtmlviewer.height">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Height

**Height** As `Double</api/data_types/double>`

The height of the control.

This property is read-only.

<div id="ioshtmlviewer.left">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Left

**Left** As `Double</api/data_types/double>`

The left position of the control.

This property is read-only.

<div id="ioshtmlviewer.name">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Name

**Name** As `Text</api/deprecated/text>`

The name of the control. This can only be set in the Inspector. Use the name to refer to the control.

This property is read-only.

<div id="ioshtmlviewer.parent">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Parent

**Parent** As `iOSControl</api/deprecated/ioscontrol>`

Indicates the control's parent object, if it has one. If there is no parent, this is Nil.

This property is read-only.

<div id="ioshtmlviewer.top">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Top

**Top** As `Double</api/data_types/double>`

The top position of the control.

This property is read-only.

<div id="ioshtmlviewer.visible">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Visible

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

Indicates whether the control is visible.

Make a button invisible:

``` xojo
Button1.Visible = False
```

<div id="ioshtmlviewer.width">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Width

**Width** As `Double</api/data_types/double>`

The width of the control.

This property is read-only.

## Method descriptions

<div id="ioshtmlviewer.addconstraint">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.AddConstraint

**AddConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Adds a constraint to the control. This constraint is used by child controls that have been added to this control.

<div id="ioshtmlviewer.addcontrol">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.AddControl

**AddControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Adds a child control to the control.

<div id="ioshtmlviewer.control">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Control

**Control**(index As `Integer</api/data_types/integer>`) As `MobileControl</api/user_interface/mobile/mobilecontrol>`

Gets the child control at the specified index.

<div id="ioshtmlviewer.controlcount">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.ControlCount

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

The number of child controls in the control.

<div id="ioshtmlviewer.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Handle

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

The handle is used to get a reference to the control for interfacing directly with the iOS API.

<div id="ioshtmlviewer.invalidate">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Invalidate

**Invalidate**

Marks the control so that it will be redrawn during the next event loop.

Call Invalidate to force a Canvas to redraw itself:

``` xojo
Canvas1.Invalidate
```

<div id="ioshtmlviewer.loadurl">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.LoadURL

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

Displays the specified URL. Be sure to include the appropriate prefix, such as "<http://>".

To load HTML from a file on the device, pass FolderItem.URLPath to LoadURL.

To load HTML from Text, first save it to a file using `TextOutputStream</api/files/textoutputstream>` and then load it using the URLPath to the FolderItem.

Display wikipedia:

``` xojo
HTMLViewer1.LoadURL("https://www.wikipedia.org")
```

To display HTML that is in a file, you can load it by using the URLPath for the file. This example saves HTML to a text file and then loads the file into an HTMLViewer:

``` xojo
Var html As Text = "<body>Hello!</body>"

Var htmlFile As FolderItem = SpecialFolder.Documents.Child("hello.html")
Var output As TextOutputStream
output = TextOutputStream.Create(htmlFile, TextEncoding.UTF8)
output.WriteLine(html)
output.Close

HTMLViewer1.LoadURL(htmlFile.URLPath)
```

<div id="ioshtmlviewer.removeconstraint">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.RemoveConstraint

**RemoveConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Removes a constraint from the control.

<div id="ioshtmlviewer.removecontrol">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.RemoveControl

**RemoveControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Removes the control from the control.

<div id="ioshtmlviewer.settintcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.SetTintColor

**SetTintColor**(value As `Color</api/data_types/color>`)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an `MobileTextField</api/user_interface/mobile/mobiletextfield>` this changes the cursor color.

## Event descriptions

<div id="ioshtmlviewer.close">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Close

**Close**

Called when the control is removed from its container, such as a view.

<div id="ioshtmlviewer.open">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSHTMLViewer.Open

**Open**

Called after the control is created. This is where you typically put initialization code.

Set label text in Open event:

``` xojo
Me.Text = "Hello"
```

## Notes

### App transport security

Starting with iOS 9, you have to use secure "https" connections or the page will not display. To continue to connect to non-secure "http" connections that you do not control you'll have to provide a plist with a temporary exception specified for each site you are accessing via http:

``` xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>firstsite.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
            <key>secondsite.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
</dict>
</plist>
```

If you don't know the specific sites, you can request access to everything using a single key:

``` xml
<key>NSAppTransportSecurity</key>
<dict>
  <!-- Include to allow all connections; avoid if possible -->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>
```

Apple may reject your App Store submission if you app uses these settings without valid reasons.

For more information about this, refer to NSAppTransportSecurity in Apple's docs. .. warning:: Apparently there is a bug in iOS that prevents the use of IP addresses in this plist. So to enable http on your local computer for testing use "localhost" rather than "127.0.0.1" and be sure to use "<http://localhost>" in your URLs instead of "<http://127.0.0.1>".

## Compatibility

iOS projects on the iOS operating system.

## See also

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `URLConnection</api/networking/urlconnection>` class; `Using a plist</topics/application_structure/ios/using_a_plist>` topic
