Dialog web
A decision block that lets the user view a web or HTML page.
The fiber will pause until the user has dismissed the dialog,
a page redirected to the intercepted ok or cancel page URL
or the timeout expired.
Intercepted page URLs controlling the dialog:
Controlling the dialog OK button:
- When the regular expression match the URL of the loaded page then it’s enabled,
i.e. use
.*
for always, otherwise it’s disabled.
- In an HTML page it can be enabled using JavaScript
automate.setOkButtonEnabled(true);
(Android 4.2+)
- Clicks on it can be ignored, preventing the dialog from closing, by cancelling the custom
automate.ok
window event using JavaScript, e.g.
window.addEventListener("automate.ok", e => e.preventDefault());
(Android 4.4+)
Browser console messages, e.g. JavaScript errors, are logged to the system log when the Debug logging option
is enabled in settings.
Use the Log await block, logcat
shell command or other “log viewing” app to view.
The Viewport argument affects how the content is laid out and scaled.
Usage examples
- Display a run-time generated HTML page by passing it as the HTML page argument.
- Browse the web by passing a regular
http://
or https://
URL as the page URL argument.
- Display local content, such as HTML, image, video, PDF, by passing an
file://
or content://
URI as the page URL argument.
- Create an (OAuth2) authentication flow for Google, Facebook, etc., to acquire an authentication token for accessing their online APIs using HTTP requests.
- Display a custom interactive layout drawn using JavaScript.
Note! Ensure to enable the appropriate allowed flags otherwise the page will fail to load.
Loading content URIs created by the fileUri, i.e with no or "a" flag, require both File access and Content access.
Options
- Allowed — what system and browser features the page is allowed to use.
Input arguments
- Page URL — URL of page to display, default is http://localhost, i.e. the HTML page.
- HTML page — HTML to display, full page source using UTF-8 charset, default is no page.
- Regular expression — enable dialog OK button while loaded page has an URL matching this regular expression, default is always disabled.
- Basic authorization account — name of generic credentials account used for basic HTTP authorization, only apply to host of page URL, default is no authorization.
- User agent — User-Agent header used when making HTTP requests, default is set by the system.
- Viewport — whether to confine viewport width to dialog width, otherwise support HTML viewport meta tag or use a wide viewport if the page lack such, default is don’t confine.
- Timeout — time until the notification/dialog is automatically canceled, may be inaccurate as it’s affected power save features such as “doze”, default is no timeout.
- Notification channel — UUID of notification channel used for shown notification, default is the flow default or Flow.
- Show window — whether to show the dialog window directly without having to tap the notification. Requires the “appear atop of other apps or parts of the screen” privilege on Android 10+.
Output variables
- Result page URL — variable to assign the URL of dismiss/exit page, if available.
- Result page title — variable to assign the title of the dismiss/exit page, if available.