Skip to content

iOSBrowser

Static API for launching the in-app browser from Unity.

Kodster.InAppWebBrowser.iOS.iOSBrowser

Overview

  • On non-iOS platforms (including the Unity Editor), Open is a no-op and onClosed is invoked immediately.

Methods

Open

public static void Open(
    string url,
    iOSBrowserOptions options = null,
    Action onClosed = null,
    Action<bool> onInitialLoadCompleted = null,
    Action<string> onRedirected = null,
    Action onOpenedInExternalBrowser = null
)

Opens the specified URL in the in-app browser.

Parameters

  • url (string): The URL to open.
  • options (iOSBrowserOptions, optional): Visual and behavioral configuration. When null, defaults are used.
  • onClosed (Action, optional): Invoked when the browser is closed.
  • onInitialLoadCompleted (Action<bool>, optional): Invoked when the initial page load finishes. The bool indicates success.
  • onRedirected (Action<string>, optional): Invoked with the resolved URL if the initial load is redirected before completing.
  • onOpenedInExternalBrowser (Action, optional): Invoked when the URL is handed off to an external app.

Throws

  • ArgumentException: If url is null, empty, whitespace, or not a valid absolute http/https URL.

Remarks

  • Opening a new browser while a previous one is still pending logs a warning; the previous callbacks will not be invoked.

Close

public static void Close()

Closes the in-app browser.

PrefetchUrl

public static void PrefetchUrl(string url)

Pre-warms the browser connection for the given URL to improve perceived launch speed.

Parameters

  • url (string): The URL to pre-warm.

Throws

  • ArgumentException: If url is null, empty, whitespace, or not a valid absolute http/https URL.

PrefetchUrls

public static void PrefetchUrls(IEnumerable<string> urls)

Pre-warms the browser connections for the given URLs.

Parameters

  • urls (IEnumerable<string>): The URLs to pre-warm.

Throws

  • ArgumentNullException: If urls is null.
  • ArgumentException: If any URL in the sequence is null, empty, whitespace, or not a valid absolute http/https URL.