To interact with remote content, wait until the content is loaded, then use the
evalJS method to execute a JavaScript expression
inside the web view and retrieve the value of an expression.

Local JavaScript Files

During the build process for creating a package, all JavaScript files, that is, any file with a
'.js' extension, are removed and their content is encrypted and obfuscated into one resource,
causing these files to not load properly in a WebView if they are loaded externally.

For JavaScript files referenced in static local HTML files, these JavaScript files are omitted
from processing and left intact, which means they can be correctly loaded in the WebView.

For local JavaScript files not referenced in static local HTML files, for example, a
dynamically-generated HTML file referencing a local JavaScript file,
rename the file extension of the local JavaScript files to '.jslocal' instead of '.js'.

The build process for testing your application on the simulator, emulator or device does not
affect the loading of local JavaScript files.

iOS Platform Implementation Notes

On the iOS platform, the native web view handles scrolling and other related touch
events internally. If you add event listeners on the web view or its parent views
for any of the standard touch events (touchstart, click, and so on), these events
do not reach the native web view, and the user will not be able to scroll, zoom, click
on links, and so on. To prevent this default behavior, set
willHandleTouches to false.

In other words, you can have either Titanium-style events against the
web view instance, or internal JavaScript events in the DOM, but not both.

Android Platform Implementation Notes

Android 4.4 and Later Support

Starting with Android 4.4 (API Level 19), the WebView component is based off of Chromium,
introducing a number of changes to its rendering engine. Web content may look or behave
differently depending on the Android version. The WebView does not
have full feature parity with Chrome for Android.

By default, the Chromium WebView uses hardware acceleration, which may cause content to
fail to render. If the WebView fails to render the content, the web view will clear
itself, displaying only the default background color. The following log messages will be
displayed in the console:

To workaround this issue, you can enable software rendering by setting the WebView's
borderRadius property to a value greater than zero.

If you are developing local HTML content and size your elements using percentages, the WebView may
not calculate the sizes correctly when hardware acceleration is enabled, resulting in the same
behavior previously mentioned.

To workaround this issue, you can use the previously mentioned workaround to enable software
rendering, use absolute size values or use the
onresize event to set the
heights of the components. For example, if you have a div element with an id set to component
that needs to use the entire web view, the following callback resizes the content to use the
full height of the web view:

You must also call pause when the current activity is
paused, to prevent plugin content from continuing to run in the background. Call
resume when the current activity is resumed. You can
do this by adding listeners for the Activity.pause
and Activity.resume events.

Properties

Whether the view should be "hidden" from (i.e., ignored by) the accessibility service. ...

Whether the view should be "hidden" from (i.e., ignored by) the accessibility service.

Requires:
Android 4.0 and later
iOS 5.0 and later

On iOS this is a direct analog of the accessibilityElementsHidden property defined in the
UIAccessibility
Protocol.
The native property is only available in iOS 5.0 and later; if
accessibilityHidden is specified on earlier versions of iOS, it is ignored.

On Android, setting accessibilityHidden calls the native
View.setImportantForAccessibility
method. The native method is only available in Android 4.1 (API level 16/Jelly Bean) and
later; if this property is specified on earlier versions of Android, it is ignored.

A Boolean value that determines whether pressing on a link displays a preview of the
destination for the link. ...

A Boolean value that determines whether pressing on a link displays a preview of the
destination for the link.

Requires:
iOS 9.0 and later

This property is available on devices that support 3D Touch. Default value is false.

If you set this value to true for a web view, users (with devices that support 3D Touch)
can preview link destinations, and can preview detected data such as addresses, by pressing on links.
Such previews are known to users as peeks. If a user presses deeper, the preview navigates (or pops,
in user terminology) to the destination. Because pop navigation switches the user from your app to
Safari, it is opt-in, by way of this property, rather default behavior for this class.

A gradient can be defined as either linear or radial. A linear gradient varies continuously
along a line between the startPoint and endPoint.

A radial gradient is interpolated between two circles, defined by startPoint and
startRadius and endPoint and endRadius respectively.

The start and end points and radius values can be defined in device units, in the view's
coordinates, or as percentages of the view's size. Thus, if a view is 60 x 60, the center
point of the view can be specified as:

{ x: 30, y: 30 }

Or:
{ x: '50%', y: '50%' }

When specifying multiple colors, you can specify an offset value for each color, defining
how far into the gradient it takes effect. For example, the following color array specifies
a gradient that goes from red to blue back to red:

Background image for the view, specified as a local file path or URL. ...

Background image for the view, specified as a local file path or URL.

Default: Default behavior when `backgroundImage` is unspecified depends on the type of view and
the platform. For generic views, no image is used. For most controls (buttons, text
fields, and so on), platform-specific default images are used.

Setting this to true makes the set backgroundImage repeat across the view as a series
of tiles. The tiling begins in the upper-left corner, where the upper-left corner of the
background image is rendered. The image is then tiled to fill the available space of the
view.

Note that setting this to true may incur performance penalties for large views or
background images, as the tiling must be redone whenever a view is resized.

On iOS, the following views do not currently support tiled backgrounds:

An array of url strings to blacklist. This will stop the webview from going to urls listed in
the blacklist. Note, this only applies in the links clicked inside the webview. The first website
that is loaded will not be stopped even if it matches the blacklist.

Some proxies (most commonly views) have a relationship to other proxies, often
established by the add() method. For example, for a button added to a window, a
click event on the button would bubble up to the window. Other common parents are
table sections to their rows, table views to their sections, and scrollable views
to their views. Set this property to false to disable the bubbling to the proxy's parent.

By default any urls that are not handled by the Titanium platform but can be handled by the
shared application are automatically sent to the shared application and the webview does not
open these. When this property is set to true the webview will attempt to handle these
urls and they will not be sent to the shared application. An example is links to telephone
numbers.

'auto'. Represents the default sizing behavior for a given type of
view. The use of 'auto' is deprecated, and should be replaced with the SIZE or
FILL constants if it is necessary to set the view's behavior explicitly.

This is an input property for specifying the view's height dimension. To determine the
view's size once rendered, use the rect or
size properties.

When this property is set to true, the user must explicitly tap the elements in the web view
to display the keyboard (or other relevant input view) for that element. When set to false,
a focus event on an element causes the input view to be displayed and associated with
that element automatically.

Specifies how the view positions its children.
One of: 'composite', 'vertical', or 'horizontal'.

There are three layout options:

composite (or absolute). Default layout. A child view is positioned based on its
positioning properties or "pins" (top, bottom, left, right and center).
If no positioning properties are specified, the child is centered.

The child is always sized based on its width and height properties, if these are
specified. If the child's height or width is not specified explicitly, it may be
calculated implicitly from the positioning properties. For example, if both left and
center.x are specified, they can be used to calculate the width of the child control.

Because the size and position properties can conflict, there is a specific precedence
order for the layout properties. For vertical positioning, the precedence
order is: height, top, center.y, bottom.

The following table summarizes the various combinations of properties that can
be used for vertical positioning, in order from highest precedence to lowest.
(For example, if height, center.y and bottom are all specified, the
height and center.y values take precedence.)

vertical. Children are laid out vertically from top to bottom. The first child
is laid out top units from its parent's bounding box. Each subsequent child is
laid out below the previous child. The space between children is equal to the
upper child's bottom value plus the lower child's top value.

Each child is positioned horizontally as in the composite layout mode.

horizontal. Horizontal layouts have different behavior depending on whether wrapping
is enabled. Wrapping is enabled by default (the horizontalWrap property is true).

With wrapping behavior, the children are laid out horizontally from left to right,
in rows. If a child requires more horizontal space than exists in the current row,
it is wrapped to a new row. The height of each row is equal to the maximum height of
the children in that row.

Wrapping behavior is available on iOS and Android (Release 2.1.0 and later).
When the horizontalWrap property is set to true, the first row is placed at the top of the
parent view, and successive rows are placed below the first row. Each child is
positioned vertically within its row somewhat like composite layout mode.
In particular:

If neither top or bottom is specified, the child is centered in the
row.

If either top or bottom is specified, the child is aligned to either
the top or bottom of the row, with the specified amount of padding.

If bothtop and bottom is specified for a given child, the properties
are both treated as padding.

If the horizontalWrap property is false, the behavior is more equivalent to a vertical layout.
Children are laid or horizontally from left to right in a single row. The left and
right properties are used as padding between the children, and the top and bottom
properties are used to position the children vertically.

On Android and iOS prior to Release
2.1.0, the horizontal layout always wraps and the horizontalWrap property is not supported.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks
will also be called on the proxy. Proxies that require the activity lifecycle will need this property set
to the appropriate containing Window or TabGroup.

Callback function called when there is a request for the application to create a new window
to host new content.

Callback function called when there is a request for the application to create a new window
to host new content.

For example, the request is triggered if a web page wants to open a URL in a new
window. By default, Titanium will open a new full-size window to host the new content.
Use the callback to override the default behavior.

The callback needs to create a new WebView object to host the content in and add the WebView to the
application UI. The callback must return either a WebView object to host the content in or null if
it does not wish to handle the request.

The callback is passed a dictionary with two boolean properties:

isDialog: set to true if the content should be opened in a dialog window rather than a
full-size window.

isUserGesture: set to true if the user initiated the request with a gesture, such as
tapping a link.

The following example opens new web content in a new tab rather than a new window:

Determines how to treat content that requires plugins in this web view. ...

Determines how to treat content that requires plugins in this web view.

Requires:
Android 2.2 and later

This setting affects the loading of content that requires web plugins, such as
Flash Player.

To use the Flash Player plugin, hardware acceleration must be enabled for your
application. To enable hardware acceleration, add the tool-api-level and
manifest elements shown below inside the android element in your tiapp.xml file.

On iOS, setting this to true sets the initial zoom level to show the entire
page, and enables the user to zoom the web view in and out. Setting this to
false prevents the user from zooming the web view.

On Android, only controls the initial zoom level.

Default: `false` on iOS. On Android, `false` when content is specified as a local URL,
`true` for any other kind of content (remote URL, `Blob`, or `File`).

The scroll-to-top gesture is a tap on the status bar; The default value of this property is true.
This gesture works when you have a single visible web view.
If there are multiple table views, web views, text areas, and/or scroll views visible,
you will need to disable (set to false) on the above views you DON'T want this
behaviour on. The remaining view will then respond to scroll-to-top gesture.

'auto'. Represents the default sizing behavior for a given type of
view. The use of 'auto' is deprecated, and should be replaced with the SIZE or
FILL constants if it is necessary to set the view's behavior explicitly.

This is an input property for specifying the view's width dimension. To determine
the view's size once rendered, use the rect or
size properties.

On the iOS platform, if this web view or any of its parent views have touch
listeners, the Titanium component intercepts all touch events. This
prevents the user from interacting with the native web view components.

Set this flag to false to disable the default behavior. Setting this property to false
allows the user to interact with the native web view and still honor any touch events sent to
its parents. No touch events will be generated when the user interacts with the web view itself.

Set this flag to true if you want to receive touch events from the web view and
the user does not need to interact with the web content directly.

This flag is true by default to retain backwards compatibility with previous
behavior.

A view does not have a default z-index value, meaning that it is undefined by default.
When this property is explicitly set, regardless of its value, it causes the view to be
positioned in front of any sibling that has an undefined z-index.

Returns

The Animation object or dictionary passed to this method defines
the end state for the animation, the duration of the animation, and other properties.

Note that if you use animate to move a view, the view's actual position is changed, but
its layout properties, such as top, left, center and so on are not changed--these
reflect the original values set by the user, not the actual position of the view.

The rect property can be used to determine the actual size and
position of the view.

Returns

Add a pause handler to your Titanium.Android.Activity and invoke
this method to pause native plugins. This is important with Flash content
as it will continue in the background unless this method is invoked.

To prevent a layout pass each time a property is modified, call startLayout before
changing any properties that may change this view's layout. This initiates a batch update
mode where layout changes are deferred.

Call finishLayout to end batch update mode and trigger a
layout pass. For example:

Note that any property changes made during the batch update may be deferred until
finishLayout is called. This may vary somewhat by platform. For example, changing the
text of a label may trigger a layout pass. In iOS, updating the label text is
deferred.

Returns

Events

This event may fire multiple times depending on the content or URL. For example, if you set
the URL of the web view to a URL that redirects to another URL, such as an HTTP URL
redirecting to an HTTPS URL, this event is fired for the original URL and the redirect URL.

This event is fired when the view and its ancestors have been laid out.
The rect and size values
should be usable when this event is fired.

This event is typically triggered by either changing layout
properties or by changing the orientation of the device. Note that changing the
layout of child views or ancestors can also trigger a relayout of this view.

Note that altering any properties that affect layout from the postlayout callback
may result in an endless loop.

A touchcancel can happen in circumstances such as an incoming call to allow the
UI to clean up state.

Properties

x : Number

X coordinate of the event from the source view's coordinate system.

y : Number

Y coordinate of the event from the source view's coordinate system.

force : Number

The current force value of the touch event.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices.

size : Number

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForce : Number

Maximum possible value of the force property.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

altitudeAngle : Number

A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is
being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0.
Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later.

timestamp : Number

The time (in seconds) when the touch was used in correlation with the system start up.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

azimuthUnitVectorInViewX : Number

The x value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

azimuthUnitVectorInViewY : Number

The y value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

On the Android platform, other gesture events, such as longpress or swipe, cancel touch
events, so this event may not be triggered after a touchstart event.

Properties

x : Number

X coordinate of the event from the source view's coordinate system.

y : Number

Y coordinate of the event from the source view's coordinate system.

force : Number

The current force value of the touch event.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices.

size : Number

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForce : Number

Maximum possible value of the force property.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

altitudeAngle : Number

A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is
being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0.
Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later.

timestamp : Number

The time (in seconds) when the touch was used in correlation with the system start up.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

azimuthUnitVectorInViewX : Number

The x value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

azimuthUnitVectorInViewY : Number

The y value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Penciland are 9.1 or later.

Event coordinates are always relative to the view in which the initial touch occurred

Properties

x : Number

X coordinate of the event from the source view's coordinate system.

y : Number

Y coordinate of the event from the source view's coordinate system.

force : Number

The current force value of the touch event.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices.

size : Number

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForce : Number

Maximum possible value of the force property.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

altitudeAngle : Number

A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is
being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0.
Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later.

timestamp : Number

The time (in seconds) when the touch was used in correlation with the system start up.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

azimuthUnitVectorInViewX : Number

The x value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

azimuthUnitVectorInViewY : Number

The y value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

Properties

The current force value of the touch event.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices.

size : Number

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForce : Number

Maximum possible value of the force property.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

altitudeAngle : Number

A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is
being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0.
Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later.

timestamp : Number

The time (in seconds) when the touch was used in correlation with the system start up.
Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later.

azimuthUnitVectorInViewX : Number

The x value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.

azimuthUnitVectorInViewY : Number

The y value of the unit vector that points in the direction of the azimuth of the stylus.
Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later.