Modules.WebDialog
Allows a Titanium application to use the Safari Controller (iOS) and Chrome Tabs (Android) to create an embedded browser.
The WebDialog module provides Titanium access to the native SFSafariViewController (iOS) and ChromeTabs (Android). This enables you to deliver interactive web content in your app just like the built-in browser, including the native UI elements already familiar to your users.
Requirements
The WebDialog module is available with the Titanium SDK starting with Release 7.1.0. This module only works with devices running iOS 9 / Android 4.1 and later. Please make sure you have at least Xcode 7 to build to the required iOS sources.
Getting Started
Add the module as a dependency to your application by adding a <module> item to the <modules> element of your tiapp.xml file:
<ti:app>
<!-- ... -->
<modules>
<module platform="iphone">ti.webdialog</module>
</modules>
<!-- ... -->
</ti:app>Use require() to access the module from JavaScript:
var dialog = require('ti.webdialog');The dialog variable is a reference to the module. Make API calls using this reference:
if (dialog.isSupported()) {
dialog.open({
url: 'https://titaniumsdk.com'
});
}Sample Application
The module contains a sample application in the <TITANIUM_SDK_HOME>/modules/iphone/ti.webdialog/<VERSION>/example/ folder.
Extends: Titanium.Module · Since: 7.1.0 · Platforms: iphone, ipad, android
Properties #
DISMISS_BUTTON_STYLE_CANCEL#
Type: Number
Button style used to display a localized "Cancel" button.
Use with the dismissButtonStyle property in Modules.WebDialog.open.
DISMISS_BUTTON_STYLE_CLOSE#
Type: Number
Button style used to display a localized "Close" button.
Use with the dismissButtonStyle property in Modules.WebDialog.open.
DISMISS_BUTTON_STYLE_DONE#
Type: Number
Button style used to display a localized "Done" button.
Use with the dismissButtonStyle property in Modules.WebDialog.open.
Methods #
close #
Programmatically closes the web dialog.
var dialog = require('ti.webdialog');
if (dialog.isOpen()) {
dialog.close();
}
open #
Opens the web dialog with the options provided.
var dialog = require('ti.webdialog');
if (dialog.isSupported()) {
dialog.open({
url: 'https://titaniumsdk.com',
tintColor: 'red'
});
}
| Name | Type | Summary | Optional |
|---|---|---|---|
params | WebDialogOpenParams | Dictionary used to configure the web dialog. | No |
Events #
close #
The close event is fired when the web dialog is closed by the user
or programmatically.
| Name | Type | Summary |
|---|---|---|
url | String | The URL provided when opening the web dialog. |
load #
Fired when the initial URL load is complete.
This event is invoked when the erb dialog completes the loading of the
URL that you pass to it's initializer. It is not invoked for any subsequent
page loads in the same web dialog instance.
| Name | Type | Summary |
|---|---|---|
url | String | The URL provided when opening the web dialog. |
success | Boolean | Returns true if loading completed successfully, false otherwise. |
open #
The open event is fired after the web dialog has opened.
| Name | Type | Summary |
|---|---|---|
url | String | The URL provided when opening the web dialog. |
redirect #
Fired when the browser is redirected to another URL before the first page load finishes.
| Name | Type | Summary |
|---|---|---|
url | String | The URL provided when opening the web dialog. |