Styled WebView with Configuration

Goal

Customize WebView appearance, size, position, and behavior for branded content integration.

Actions Required

Action
Purpose

WebViewCreateInstance

Creates WebView instance

WebViewConfigure

Applies style/frame/background and other options

WebViewLoadURL

Loads content

WebViewShow

Displays WebView

Variables Needed

  • webViewInstance (Object): Stores the WebView instance

  • webViewStyle (Enum/Int): Style type (0=Default, 1=Popup, 2=Browser)

  • frameX, frameY, frameWidth, frameHeight (Float): Position and size

  • backgroundColor (Color): Background color

  • targetURL (String): URL to load

Implementation Steps

1. State: CreateWebView

Action: WebViewCreateInstance

  • Outputs:

    • webViewInstance β†’ Store in FsmObject variable

  • Next: ConfigureWebView

2. State: ConfigureWebView

Action: WebViewConfigure

  • Inputs (all optional):

    • webViewInstance β†’ From variable

    • style β†’ webViewStyle variable

    • backgroundColor β†’ backgroundColor variable

    • frameX/frameY/frameWidth/frameHeight β†’ set all 4 together

  • Next: LoadContent

Style Options:

  • 0 (Default): Fullscreen WebView

  • 1 (Popup): Centered WebView with semi-transparent overlay

  • 2 (Browser): WebView with navigation controls

Note: Coordinates are normalized (0.0 to 1.0), where (0,0) is bottom-left, (1,1) is top-right.

3. State: LoadContent

Action: WebViewLoadURL

  • Inputs:

    • webViewInstance β†’ From variable

    • url β†’ targetURL variable

  • Next: ShowWebView

4. State: ShowWebView

Action: WebViewShow

  • Inputs:

    • webViewInstance β†’ From variable

  • Events:

    • successEvent β†’ End

    • failureEvent β†’ ShowError

Common Issues

  • WebView wrong size: Remember coordinates are normalized (0.0-1.0), not pixels

  • Style not applied: Set style BEFORE showing WebView

  • Background color not visible: Only shows while content is loading or for transparent areas

  • Frame not updating: Set frame before showing, or hide/show to refresh

Flow Diagram

Best Practices

  • Configure all appearance settings BEFORE loading content

  • Use normalized coordinates (0.0-1.0) for resolution independence

  • Test on multiple screen sizes/orientations

  • Match background color to your app theme

  • Consider safe areas on notched devices (iOS)

Example Configurations

Fullscreen Browser

Centered Popup (70% size)

Bottom Sheet (40% height)

Side Panel (30% width, right side)

Terms & Conditions Dialog

Advanced: Property Configuration

Beyond basic styling, configure behavior by providing optional fields to WebViewConfigure:

Auto-Show on Load

Disable JavaScript (for static content)

Enable Scroll Bounce (iOS)

Scale to Fit

Responsive Layouts

For landscape/portrait support, use different frame values:

Safe Area Consideration (iOS)

For devices with notches, adjust frame to avoid overlap:

Dynamic Resizing

You can update frame at runtime:

Last updated

Was this helpful?