import type { PluginListenerHandle } from '@capacitor/core'; export interface UrlEvent { /** * Webview instance id. */ id?: string; /** * Emit when the url changes * * @since 0.0.1 */ url: string; } /** * Event emitted when the managed webview intercepts a non-standard custom scheme * and hands it to the operating system. * * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded. * * @since 8.6.7 */ export interface CustomSchemeInterceptedEvent { /** * Webview instance id. */ id?: string; /** * Intercepted URL. */ url: string; /** * Whether the operating system accepted the URL handoff. */ opened: boolean; } export interface BtnEvent { /** * Webview instance id. */ id?: string; /** * Emit when a button is clicked. * * @since 0.0.1 */ url: string; } export interface ButtonNearDoneEvent { /** * Webview instance id. * * @since 8.6.36 */ id: string; } export type UrlChangeListener = (state: UrlEvent) => void; export type ConfirmBtnListener = (state: BtnEvent) => void; export type ButtonNearListener = (state: ButtonNearDoneEvent) => void; export type CustomSchemeInterceptedListener = (state: CustomSchemeInterceptedEvent) => void; export type WebViewPointerInputEventType = 'click' | 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel'; export type WebViewInputEventType = WebViewPointerInputEventType | 'scroll'; export declare enum BackgroundColor { WHITE = "white", BLACK = "black" } export declare enum ToolBarType { /** * Shows a simple toolbar with just a close button and share button * @since 0.1.0 */ ACTIVITY = "activity", /** * Shows a simple toolbar with just a close button * @since 7.6.8 */ COMPACT = "compact", /** * Shows a full navigation toolbar with back/forward buttons * @since 0.1.0 */ NAVIGATION = "navigation", /** * Shows no toolbar * @since 0.1.0 */ BLANK = "blank" } export declare enum InvisibilityMode { /** * WebView is aware it is hidden (dimensions may be zero). */ AWARE = "AWARE", /** * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible). */ FAKE_VISIBLE = "FAKE_VISIBLE" } export declare enum CloseAction { /** * The toolbar close button closes and destroys the webview. */ CLOSE = "close", /** * The toolbar close button hides the webview so it can be shown again. */ HIDE = "hide" } /** * Web content rendering mode for managed WKWebViews on iOS. * * @since 8.18.0 */ export type PreferredContentMode = 'recommended' | 'mobile' | 'desktop'; export declare enum CloseButtonPosition { /** * Leading edge of the toolbar (left in left-to-right layouts). */ START = "start", /** * Trailing edge of the toolbar (right in left-to-right layouts). */ END = "end" } export interface ToolbarTitleIconOptions { ios?: { iconType: 'sf-symbol' | 'asset'; icon: string; }; android?: { iconType: 'asset' | 'vector'; icon: string; width?: number; height?: number; }; } export interface Headers { [key: string]: string; } export interface GetCookieOptions { url: string; includeHttpOnly?: boolean; } export interface ClearCookieOptions { /** * Target webview id. * When omitted, applies to all open webviews. */ id?: string; url: string; } export interface Credentials { username: string; password: string; } export interface LayerOptions { /** * Target webview id. If omitted, targets the active webview. */ id?: string; /** * Makes the Capacitor host WebView transparent while this native webview is behind it. * * @default true */ transparentBackground?: boolean; } export interface BringToFrontOptions { /** * Target webview id. If omitted, targets the active webview. */ id?: string; /** * Whether bringing the webview to the front is animated on iOS. * * @default true */ isAnimated?: boolean; } export interface DispatchPointerInputEventOptions { /** * Target webview id. If omitted, targets the active webview. */ id?: string; /** * Input event to dispatch to the webview. */ type: WebViewPointerInputEventType; /** * X coordinate in CSS pixels from the webview's left edge. */ x: number; /** * Y coordinate in CSS pixels from the webview's top edge. */ y: number; } export interface DispatchScrollInputEventOptions { /** * Target webview id. If omitted, targets the active webview. */ id?: string; /** * Input event to dispatch to the webview. */ type: 'scroll'; /** * X coordinate in CSS pixels from the webview's left edge. */ x: number; /** * Y coordinate in CSS pixels from the webview's top edge. */ y: number; /** * Horizontal scroll delta in CSS pixels. Used when `type` is `scroll`. */ deltaX: number; /** * Vertical scroll delta in CSS pixels. Used when `type` is `scroll`. */ deltaY: number; } export type DispatchInputEventOptions = DispatchPointerInputEventOptions | DispatchScrollInputEventOptions; /** * Represents an intercepted HTTP request from the in-app browser webview. * * Request and response bodies are base64-encoded when present. * * @since 8.6.0 */ export interface ProxyRequest { requestId: string; phase: 'outbound' | 'inbound'; url: string; method: string; headers: Record; body: string | null; status?: number; responseHeaders?: Record; responseBody?: string | null; webviewId: string; } /** * Response payload returned to native for a proxied request. * * The body must be base64-encoded. * * @since 8.6.0 */ export interface ProxyResponse { body: string; status: number; headers: Record; } /** * Request override returned to native for an outbound proxied request. * * The body must be base64-encoded when present. * * @since 8.6.0 */ export interface ProxyRequestOverride { url: string; method?: string; headers?: Record; body?: string | null; } /** * Event emitted when a web page opens a popup/new window. * * @since 8.6.0 */ export interface PopupWindowEvent { /** * Popup webview instance id. */ id: string; /** * Parent webview instance id. */ parentId?: string; /** * Requested popup URL when available. */ url?: string; /** * Whether the popup was presented immediately. */ visible: boolean; } /** * Event emitted when JavaScript running inside the managed webview writes to the console. * * Enable this with `captureConsoleLogs: true` when opening the webview. * * @since 8.6.0 */ export interface ConsoleMessageEvent { /** * Source webview instance id. */ id?: string; /** * Console method or normalized severity. */ level: 'log' | 'info' | 'warn' | 'error' | 'debug' | 'assert' | string; /** * Joined string representation of the console arguments. */ message: string; /** * Script URL or page URL when available. */ source?: string; /** * 1-based line number when available. */ line?: number; /** * 1-based column number when available. */ column?: number; /** * Optional subtype for runtime-originated errors on supported platforms. */ kind?: string; } /** * Native handling mode used after a managed download finishes. * * @since 8.6.0 */ export type DownloadHandledBy = 'inAppBrowser' | 'systemPreview' | 'external'; /** * Event emitted after a managed download is saved locally. * * @since 8.6.0 */ export interface DownloadCompletedEvent { /** * Source webview instance id. */ id?: string; /** * Original URL that triggered the download when available. */ sourceUrl?: string; /** * Saved filename. */ fileName: string; /** * Resolved MIME type when available. */ mimeType?: string; /** * Absolute native filesystem path to the saved file. */ path: string; /** * `file://` URL pointing at the saved file. */ localUrl: string; /** * How native handled the downloaded file after saving it. */ handledBy: DownloadHandledBy; } /** * Event emitted when managed download handling fails. * * @since 8.6.0 */ export interface DownloadFailedEvent { /** * Source webview instance id. */ id?: string; /** * Original URL that triggered the download when available. */ sourceUrl?: string; /** * Intended filename when known. */ fileName?: string; /** * Resolved MIME type when available. */ mimeType?: string; /** * Native error message. */ error: string; } /** * Decision returned to native when handling a proxied request. * * @since 8.6.0 */ export interface ProxyDecision { request?: ProxyRequestOverride | null; response?: ProxyResponse | null; cancel?: boolean; } /** * Native-first proxy rule used on Android and iOS. * * Any regex property that is omitted is treated as a wildcard. * * @since 8.6.0 */ export interface NativeProxyRule { id?: string; urlRegex?: string; methodRegex?: string; headerRegex?: string; bodyRegex?: string; statusRegex?: string; responseHeaderRegex?: string; responseBodyRegex?: string; mainFrameOnly?: boolean; action: 'continue' | 'cancel' | 'delegateToJs'; } export type ProxyHandlerResult = Response | ProxyResponse | ProxyRequestOverride | ProxyDecision | null; /** * JavaScript callback used to handle proxied requests. * * Return a `Response`, `ProxyResponse`, `ProxyRequestOverride`, `ProxyDecision`, * or `null` to let native continue unchanged. * * @since 8.6.0 */ export type ProxyHandler = (request: ProxyRequest) => ProxyHandlerResult | Promise; export interface OpenOptions { /** * Target URL to load. * * Remote `http://` and `https://` URLs are loaded as-is. Relative bundled paths * such as `/index.html` are not supported; use `openWebView()` instead. * * @since 0.1.0 * @example "https://capgo.app" */ url: string; /** * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. * @since 0.1.0 */ isPresentAfterPageLoad?: boolean; /** * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link * @since 0.1.0 */ preventDeeplink?: boolean; /** * Toolbar background color in hex format (e.g., "#1A1A2E"). * Applied to both light and dark color schemes. * Also sets the navigation bar color to match. * **Android only** — ignored on iOS. * @since 8.2.0 */ toolbarColor?: string; /** * Whether the URL bar should auto-hide when the user scrolls down. * The bar reappears on any upward scroll. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ urlBarHidingEnabled?: boolean; /** * Show the page's HTML in the toolbar instead of the raw URL. * The true URL is still visible when the user taps the title area. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ showTitle?: boolean; /** * Replace the default "X" close icon with a back arrow. * Makes the Custom Tab feel like a native navigation push rather than a modal overlay. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ showArrow?: boolean; /** * Remove the share action from the overflow menu. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ disableShare?: boolean; /** * Hide the bookmark star icon in the overflow menu. * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ disableBookmark?: boolean; /** * Hide the download icon in the overflow menu. * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates. * **Android only** — ignored on iOS. * @default false * @since 8.2.0 */ disableDownload?: boolean; } export interface OpenSecureWindowOptions { /** * The endpoint to open */ authEndpoint: string; /** * The redirect URI to use for the openSecureWindow call. * This will be checked to make sure it matches the redirect URI after the window finishes the redirection. */ redirectUri: string; /** * The name of the broadcast channel to listen to, relevant only for web */ broadcastChannelName?: string; /** * If true, the browser session will be ephemeral (no cookies or browsing data are shared with the system browser). * On iOS, this sets `prefersEphemeralWebBrowserSession = true` on `ASWebAuthenticationSession`. * On Android, this enables Custom Tabs ephemeral browsing via `setEphemeralBrowsingEnabled(true)`. * @default false * @since 6.6.0 */ prefersEphemeralWebBrowserSession?: boolean; } export interface OpenSecureWindowResponse { /** * The result of the openSecureWindow call */ redirectedUri: string; } export interface DisclaimerOptions { /** * Title of the disclaimer dialog * @default "Title" */ title: string; /** * Message shown in the disclaimer dialog * @default "Message" */ message: string; /** * Text for the confirm button * @default "Confirm" */ confirmBtn: string; /** * Text for the cancel button * @default "Cancel" */ cancelBtn: string; } export interface ScreenshotResult { /** * Image format used for the screenshot. */ format: 'png'; /** * MIME type of the generated screenshot. */ mimeType: 'image/png'; /** * Base64-encoded screenshot payload without the data URL prefix. */ base64: string; /** * Data URL for direct use in HTML img tags or uploads. */ dataUrl: string; /** * Screenshot width in pixels. */ width: number; /** * Screenshot height in pixels. */ height: number; } export interface HideEvent { /** * Webview instance id. */ id?: string; /** * URL active when the webview was hidden. */ url: string; /** * Screenshot captured immediately before the toolbar close button hides the webview. * Present only when `screenshotOnHide` is enabled and capture succeeds. */ screenshot?: ScreenshotResult; } export type HideListener = (state: HideEvent) => void; export interface CloseWebviewOptions { /** * Target webview id to close. If omitted, closes the active webview. */ id?: string; /** * Whether the webview closing is animated or not, ios only * @default true */ isAnimated?: boolean; } export interface OpenWebViewOptions { /** * Target URL to load. * * Remote `http://` and `https://` URLs are loaded as-is. * * To open bundled web assets from the app bundle without running a local HTTP server, * pass a relative path such as `/index.html` or `assets/page.html`. The plugin resolves it to * the Capacitor local URL for the current platform (defaults: `capacitor://localhost/...` on iOS, * `https://localhost/...` on Android; actual scheme and host follow the app's configured Capacitor * local URL) and serves files from the packaged `public/` directory, or `www/` on iOS when `public/` * is absent. * * @since 0.1.0 * @since 8.15.0 Relative bundled paths (`/index.html`, `assets/page.html`) are supported. * @example "https://capgo.app" * @example "/index.html" */ url: string; /** * Headers to send with the request. * @since 0.1.0 * @example * headers: { * "Custom-Header": "test-value", * "Authorization": "Bearer test-token" * } * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/ */ headers?: Headers; /** * Custom User-Agent string for the webview. * * When set, replaces the system default webview User-Agent on iOS and Android. * Takes precedence over a `User-Agent` entry in `headers`. * * @since 8.13.0 * @example * customUserAgent: "MyApp/1.0 (Capacitor)" * Test URL: https://www.whatismybrowser.com/detect/what-is-my-user-agent/ */ customUserAgent?: string; /** * Credentials to send with the request and all subsequent requests for the same host. * @since 6.1.0 * @example * credentials: { * username: "test-user", * password: "test-pass" * } * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/ */ credentials?: Credentials; /** * HTTP method to use for the initial request. * * **Optional parameter - defaults to GET if not specified.** * Existing code that doesn't provide this parameter will continue to work unchanged with standard GET requests. * * When specified with 'POST', 'PUT', or 'PATCH' methods that support a body, * you can also provide a `body` parameter with the request payload. * * **Platform Notes:** * - iOS: Full support for all HTTP methods with headers * - Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations * * @since 8.2.0 * @default "GET" * @example * method: "POST", * body: JSON.stringify({ token: "auth-token", data: "value" }), * headers: { "Content-Type": "application/json" } */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | string; /** * HTTP body to send with the request when using POST, PUT, or other methods that support a body. * Should be a string (use JSON.stringify for JSON data). * * **Optional parameter - only used when `method` is specified and supports a request body.** * Omitting this parameter (or using GET method) results in standard behavior without a request body. * * @since 8.2.0 * @example * method: "POST", * body: JSON.stringify({ username: "user", password: "pass" }), * headers: { "Content-Type": "application/json" } */ body?: string; /** * materialPicker: if true, uses Material Design theme for date and time pickers on Android. * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers. * @since 7.4.1 * @default false * @example * materialPicker: true * Test URL: https://show-picker.glitch.me/demo.html */ materialPicker?: boolean; /** * JavaScript Interface: * The webview automatically injects a JavaScript interface providing: * - `window.mobileApp.close()`: Closes the webview from JavaScript * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via "messageFromWebview" event) * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true * * @example * // In your webpage loaded in the webview: * document.getElementById("closeBtn").addEventListener("click", () => { * window.mobileApp.close(); * }); * * // Send data to the app * window.mobileApp.postMessage({ action: "login", data: { user: "test" }}); * * @since 6.10.0 */ jsInterface?: never; /** * Allows page JavaScript to call `window.mobileApp.takeScreenshot()`. * Disabled by default so only the host app can trigger native screenshots through the plugin API. * * @default false * @since 8.4.0 */ allowScreenshotsFromWebPage?: boolean; /** * Emits `consoleMessage` events for JavaScript `console.*` output coming from the managed page. * Useful when the webview stays hidden and you still need page-level diagnostics. * * @default false * @since 8.6.0 */ captureConsoleLogs?: boolean; /** * Controls whether the webview should persist website data such as cache, cookies, local storage, * IndexedDB, and session data. * * When false, iOS uses a non-persistent `WKWebsiteDataStore`. Android disables per-view cache and * database storage where the system WebView supports it while keeping DOM storage available so * SPAs can use `localStorage`. Android cookies use the shared WebView cookie store; clearing them * also affects the host WebView, so prefer per-URL cookie helpers instead of relying on * process-global wipes. * * @default true * @since 8.6.36 */ persistWebViewData?: boolean; /** * Clear all cookies from the InAppBrowser data store before the first navigation of this webview. * * Cordova `clearcache: 'yes'` parity. On Android, uses process-global `CookieManager.removeAllCookies()` * and starts the first navigation after the wipe callback (does not block the UI thread). On iOS, clears * cookies from the webview's `WKWebsiteDataStore` (isolated plugin store by default). On Web this is a no-op. * * @default false * @since 8.16.0 */ clearCookiesOnOpen?: boolean; /** * Clear cached website data before the first navigation of this webview. * * Cordova `cleardata: 'yes'` parity. On Android, calls `WebView.clearCache(true)` after the webview * is created. On iOS, removes disk and memory cache from the webview's `WKWebsiteDataStore`. * On Web this is a no-op. * * @default false * @since 8.16.0 */ clearCacheOnOpen?: boolean; /** * Share the host Capacitor WebView's website data store (cookies, local storage, etc.). * * On iOS 17+, InAppBrowser uses an isolated plugin-owned `WKWebsiteDataStore` by default so host * and browser data stay separate. Set this to `true` to use `WKWebsiteDataStore.default()` instead, * which shares session cookies with the Capacitor host WebView. Useful for SSO / OIDC silent login * when the IdP session was established in the main app WebView. * * Requires `persistWebViewData: true` (the default). When `persistWebViewData` is false, a * non-persistent store is used and this option has no effect. * * On Android this is a no-op: cookies are already process-global via `CookieManager`. * On Web this is a no-op. * * Warning: clearing cookies/cache for a webview opened with this flag can affect the host WebView * on iOS, because both share the same store. `clearAllBrowsingData()` still skips the host store. * * @default false * @since 8.13.6 */ useSharedDataStore?: boolean; /** * Controls Android TLS client certificate prompts during HTTPS handshakes. * Use `prompt` to show the system certificate picker; omit or use `none` to cancel silently (default). * * @default "none" * @since 8.7.5 */ clientCertificate?: 'none' | 'prompt'; /** * @deprecated Use `clientCertificate: "prompt"` instead. */ clientCertificatePrompt?: boolean; /** * Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge. * * When enabled: * - Standard attachment responses are written to a temporary file. * - `blob:` downloads are also captured when the platform supports them. * - Previewable files reopen inside the in-app browser when possible. * - Other files are handed off to the native preview or viewer flow. * - `downloadCompleted` and `downloadFailed` events notify the host app about the saved file. * * @default false * @since 8.6.0 */ handleDownloads?: boolean; /** * Share options for the webview. When provided, shows a disclaimer dialog before sharing content. * This is useful for: * - Warning users about sharing sensitive information * - Getting user consent before sharing * - Explaining what will be shared * - Complying with privacy regulations * * Note: shareSubject is required when using shareDisclaimer * @since 0.1.0 * @example * shareDisclaimer: { * title: "Disclaimer", * message: "This is a test disclaimer", * confirmBtn: "Accept", * cancelBtn: "Decline" * } * Test URL: https://capgo.app */ shareDisclaimer?: DisclaimerOptions; /** * Toolbar type determines the appearance and behavior of the browser's toolbar * - "activity": Shows a simple toolbar with just a close button and share button * - "navigation": Shows a full navigation toolbar with back/forward buttons * - "blank": Shows no toolbar * - "": Default toolbar with close button * @since 0.1.0 * @default ToolBarType.DEFAULT * @example * toolbarType: ToolBarType.ACTIVITY, * title: "Activity Toolbar Test" * Test URL: https://capgo.app */ toolbarType?: ToolBarType; /** * Subject text for sharing. Required when using shareDisclaimer. * This text will be used as the subject line when sharing content. * @since 0.1.0 * @example "Share this page" */ shareSubject?: string; /** * Title of the browser * @since 0.1.0 * @default "New Window" * @example "Camera Test" */ title?: string; /** * Native toolbar title font family. * On iOS, use the registered font family name. On Android, the plugin first tries a res/font resource name, * then falls back to a system font family name. * * @since 8.7.7 * @example "Inter" */ titleFontFamily?: string; /** * Native toolbar title icon displayed before the title text. * * For Android: * - iconType can be "asset" for a bundled SVG asset or "vector" for a drawable resource * - icon path should be in the public folder for assets (e.g. "brand.svg") * - width and height are optional and default to 24dp * * For iOS: * - iconType can be "sf-symbol" or "asset" * - for sf-symbol, icon should be the symbol name * - for asset, icon should be the asset name or bundled web asset path * * @since 8.7.7 * @example * titleIcon: { * ios: { iconType: "sf-symbol", icon: "lock.fill" }, * android: { iconType: "vector", icon: "ic_lock", width: 20, height: 20 } * } */ titleIcon?: ToolbarTitleIconOptions; /** * Background color of the browser * @since 0.1.0 * @default BackgroundColor.BLACK */ backgroundColor?: BackgroundColor; /** * If true, enables native navigation gestures within the webview. * - Android: Native back button navigates within webview history * - iOS: Enables swipe left/right gestures for back/forward navigation * @default false (Android), true (iOS - enabled by default) * @example * activeNativeNavigationForWebview: true, * disableGoBackOnNativeApplication: true * Test URL: https://capgo.app */ activeNativeNavigationForWebview?: boolean; /** * Enable pull-to-refresh (overscroll from top) to reload the current page. * - iOS: Uses UIRefreshControl on the WebView scroll view (reload commits on finger release) * - Android: Uses SwipeRefreshLayout around the WebView * * On iOS, this requires overscroll bounce. If `disableOverscroll` is `true`, * the reload gesture will not work. * * @since 8.10.8 * @default false * @example * enableReloadGesture: true */ enableReloadGesture?: boolean; /** * Disable the possibility to go back on native application, * useful to force user to stay on the webview, Android only * @default false * @example * disableGoBackOnNativeApplication: true * Test URL: https://capgo.app */ disableGoBackOnNativeApplication?: boolean; /** * Open url in a new window fullscreen * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. * Promise timing: on Android, `openWebView()` resolves with the webview id when the webview is ready to be controlled * (immediately for hidden/immediate presentation, after the first page load when `isPresentAfterPageLoad` is `true`). * On iOS, the promise resolves with the id as soon as the native webview is created, even if presentation is deferred. * @since 0.1.0 * @default false * @example * isPresentAfterPageLoad: true, * preShowScript: "await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });" * Test URL: https://capgo.app */ isPresentAfterPageLoad?: boolean; /** * Web content rendering mode for the managed WKWebView. * * Controls whether pages load with mobile or desktop layout on iPad. * Matches Capacitor's `ios.preferredContentMode` behavior. * * Resolution order when opening a webview: * 1. This per-open value * 2. Plugin config `plugins.CapgoInAppBrowser.preferredContentMode` * 3. Legacy plugin config `plugins.InAppBrowser.preferredContentMode` * 4. Capacitor config `ios.preferredContentMode` * * When unset at all levels, the system default applies (device-recommended). * * **iOS only** — ignored on Android and Web. * * @since 8.18.0 * @example * preferredContentMode: "mobile" */ preferredContentMode?: PreferredContentMode; /** * Whether the website in the webview is inspectable or not, ios only * @default false */ isInspectable?: boolean; /** * Whether the webview opening is animated or not, ios only * @default true */ isAnimated?: boolean; /** * Shows a reload button that reloads the web page * @since 1.0.15 * @default false * @example * showReloadButton: true * Test URL: https://capgo.app */ showReloadButton?: boolean; /** * closeAction controls what happens when the native toolbar close button is pressed. * This does not change the behavior of close(), JavaScript window.mobileApp.close(), or native back navigation. * * @default CloseAction.CLOSE * @since 8.7.7 * @example * closeAction: CloseAction.HIDE */ closeAction?: CloseAction; /** * Where the native toolbar close button is placed. * * When omitted, each platform keeps its convention: Android places the close button at the * start, iOS at the end (or at the start when `showArrow` is true). Setting this option * overrides that placement on both platforms. * * @since 8.17.0 * @example * closeButtonPosition: CloseButtonPosition.END */ closeButtonPosition?: CloseButtonPosition; /** * Captures the visible webview and includes it as `screenshot` in `hideEvent` * before the toolbar close button hides the webview. * * Only applies when `closeAction` is `CloseAction.HIDE`. * * On iOS, capture uses `WKWebView.takeSnapshot`. When testing through Apple's * iPhone Mirroring app with the physical device locked, the snapshot can succeed * with the correct dimensions but a fully transparent PNG. Capture works as * expected on a normal unlocked device. This appears to be an Apple mirroring * limitation rather than a plugin bug. * * @default false * @since 8.7.10 */ screenshotOnHide?: boolean; /** * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately. * @since 1.1.0 * @default false * @example * closeModal: true, * closeModalTitle: "Close Window", * closeModalDescription: "Are you sure you want to close?", * closeModalOk: "Yes, close", * closeModalCancel: "No, stay" * Test URL: https://capgo.app */ closeModal?: boolean; /** * CloseModalTitle: title of the confirm when user clicks on close button * @since 1.1.0 * @default "Close" */ closeModalTitle?: string; /** * CloseModalDescription: description of the confirm when user clicks on close button * @since 1.1.0 * @default "Are you sure you want to close this window?" */ closeModalDescription?: string; /** * CloseModalOk: text of the confirm button when user clicks on close button * @since 1.1.0 * @default "Close" */ closeModalOk?: string; /** * CloseModalCancel: text of the cancel button when user clicks on close button * @since 1.1.0 * @default "Cancel" */ closeModalCancel?: string; /** * closeModalURLPattern: a regex pattern to match against the current URL when the close button is pressed. * When provided along with closeModal: true, the close confirmation modal is only shown if the current URL matches this pattern. * If the current URL does not match, the browser closes immediately without showing the modal. * Requires closeModal to be true. * @since 7.2.0 * @example * closeModal: true, * closeModalURLPattern: ".*checkout.*" */ closeModalURLPattern?: string; /** * visibleTitle: if true the website title would be shown else shown empty * @since 1.2.5 * @default true */ visibleTitle?: boolean; /** * toolbarColor: color of the toolbar in hex format * @since 1.2.5 * @default "#ffffff" * @example * toolbarColor: "#FF5733" * Test URL: https://capgo.app */ toolbarColor?: string; /** * toolbarTextColor: color of the buttons and title in the toolbar in hex format * When set, it overrides the automatic light/dark mode detection for text color * @since 6.10.0 * @default calculated based on toolbarColor brightness * @example * toolbarTextColor: "#FFFFFF" * Test URL: https://capgo.app */ toolbarTextColor?: string; /** * showArrow: if true an arrow would be shown instead of cross for closing the window * @since 1.2.5 * @default false * @example * showArrow: true * Test URL: https://capgo.app */ showArrow?: boolean; /** * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website. * @since 6.1.0 * @default false */ ignoreUntrustedSSLError?: boolean; /** * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser. * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds) * @since 6.6.0 * @example * preShowScript: "await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });" * Test URL: https://capgo.app */ preShowScript?: string; /** * preShowScriptInjectionTime: controls when the preShowScript is injected. * - "documentStart": injects before any page JavaScript runs (good for polyfills like Firebase) * - "pageLoad": injects after page load (default, original behavior) * @since 7.26.0 * @default "pageLoad" * @example * preShowScriptInjectionTime: "documentStart" */ preShowScriptInjectionTime?: 'documentStart' | 'pageLoad'; /** * Proxy interception mode. * * - `true`: legacy blanket mode, delegates all HTTP/HTTPS requests to JavaScript. * - `string`: Android-only regex mode kept for backward compatibility. * * Prefer `outboundProxyRules` and `inboundProxyRules` for native-first matching. * * @since 6.9.0 */ proxyRequests?: boolean | string; /** * Native-first outbound proxy rules. * * @since 8.6.0 */ outboundProxyRules?: NativeProxyRule[]; /** * Native-first inbound proxy rules. * * @since 8.6.0 */ inboundProxyRules?: NativeProxyRule[]; /** * buttonNearDone allows for a creation of a custom button near the done/close button. * The button is only shown when toolbarType is not "activity", "navigation", or "blank". * * For Android: * - iconType must be "asset" * - icon path should be in the public folder (e.g. "monkey.svg") * - width and height are optional, defaults to 48dp * - button is positioned at the end of toolbar with 8dp margin * * For iOS: * - iconType can be "sf-symbol" or "asset" * - for sf-symbol, icon should be the symbol name * - for asset, icon should be the asset name * @since 6.7.0 * @example * buttonNearDone: { * ios: { * iconType: "sf-symbol", * icon: "star.fill" * }, * android: { * iconType: "asset", * icon: "public/monkey.svg", * width: 24, * height: 24 * } * } * Test URL: https://capgo.app */ buttonNearDone?: { ios: { iconType: 'sf-symbol' | 'asset'; icon: string; }; android: { iconType: 'asset' | 'vector'; icon: string; width?: number; height?: number; }; }; /** * Shows a native screenshot button near the done/close button. * The button is hidden by default and captures the current viewport when tapped. * This option uses the same toolbar slot as `buttonNearDone` and is therefore incompatible with it. * The button is only shown when toolbarType is not "activity", "navigation", or "blank". * * @default false * @since 8.4.0 */ showScreenshotButton?: boolean; /** * textZoom: sets the text zoom of the page in percent. * Allows users to increase or decrease the text size for better readability. * @since 7.6.0 * @default 100 * @example * textZoom: 120 * Test URL: https://capgo.app */ textZoom?: number; /** * enableZoom: enables pinch-to-zoom gestures in the Android WebView. * When true, built-in zoom controls are enabled and the zoom buttons are hidden. * **Android only** — ignored on iOS where zoom is enabled by default. * @since 8.5.0 * @default false * @example * enableZoom: true */ enableZoom?: boolean; /** * If true, deeplinks and external app hand-off are blocked and stay in the webview. * If false (default), custom schemes such as `tel:`, `mailto:`, and `sms:` open natively. * On iOS, listing a custom scheme under `LSApplicationQueriesSchemes` is only required when * you rely on `canOpenURL` for that scheme (for example `instagram://`). It is not required * for HTTPS `authorizedAppLinks`, and `mailto`/`tel`/`sms` open without that Info.plist entry. * @since 0.1.0 * @default false * @example * preventDeeplink: true * Test URL: https://aasa-tester.capgo.app/ */ preventDeeplink?: boolean; /** * When true, HTTP and HTTPS links opened from `target="_blank"` anchors stay in the current webview instead of spawning a popup or opening in the system browser. * By default, blank-target HTTP(S) links stay inside the plugin as managed popups that share cookies with the opener; enabling this option keeps everything in the same tab. * Custom schemes such as `tel:` and `mailto:` and authorized app links still prefer their native handlers unless `preventDeeplink` is enabled. * * @since 8.5.6 * @default false * @example * openBlankTargetInWebView: true */ openBlankTargetInWebView?: boolean; /** * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS). * * - On both platforms, only HTTP(S) links whose host matches any entry in this list * will attempt to leave the in-app browser for the native / system handler. * - iOS tries a Universal Link first (`universalLinksOnly`), then falls back to a normal * system open (App Store, Safari, etc.). Only if both fail does the URL stay in-webview. * - Android uses an `ACTION_VIEW` intent for matching hosts. * - Matching is host-based (case-insensitive), ignoring the "www." prefix. * - HTTPS hosts do not need `LSApplicationQueriesSchemes`; that Info.plist key is for * custom schemes like `instagram://`, not `https://instagram.com`. * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list. * * @example * ```ts * ["https://example.com", "https://instagram.com", "https://apps.apple.com"] * ``` * * @since 7.12.0 * @default [] */ authorizedAppLinks?: string[]; /** * If true, the webView is inset by the bottom system bar (navigation bar) so bottom-anchored * content stays reachable. When false (default), the webView can extend behind the navigation bar * and apps can use `env(safe-area-inset-*)` for layout, matching the main Capacitor WebView. * On pre-API 30 devices with a transparent navigation bar, bottom padding may still be applied * when the window lays out behind the navigation bar regardless of this option. * @since 7.13.0 * @default false * @example * enabledSafeBottomMargin: true */ enabledSafeBottomMargin?: boolean; /** * If false, the webView will extend behind the status bar for true full-screen immersive content. * When true (default), respects the safe area at the top of the screen. * Works independently of toolbarType - use for full-screen video players, games, or immersive web apps. * On Android, when a toolbar is visible the toolbar itself provides that safe area; with * `toolbarType: 'blank'` on Android 15+ the status bar inset is applied to the webView instead. * @since 8.2.0 * @default true * @example * enabledSafeTopMargin: false // Full screen, extends behind status bar */ enabledSafeTopMargin?: boolean; /** * When true, applies the system status bar inset to the top of the WebView on Android even when * the window is not edge-to-edge (before Android 15). Keeps the legacy 0px inset by default for * apps that handle padding themselves. On Android 15+ this is not needed: without a visible * toolbar the status bar inset already follows `enabledSafeTopMargin`. * @default false * @example * useTopInset: true */ useTopInset?: boolean; /** * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API. * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy. * Only enable this if you need Google Pay functionality as it allows popup windows. * * When enabled: * - Allows popup windows for Google Pay authentication * - Sets proper CORS headers for Payment Request API * - Enables multiple window support in WebView * - Configures secure context for payment processing * * @since 7.13.0 * @default false * @example * enableGooglePaySupport: true * Test URL: https://developers.google.com/pay/api/web/guides/tutorial */ enableGooglePaySupport?: boolean; /** * Opens popup windows created by the page in hidden mode. * Hidden popup windows can still be controlled with `executeScript`, `postMessage`, `show`, and `close`. * Listen to `popupWindowOpened` to capture the popup id, then call `show({ id })` only if you want to reveal it. * * @default false * @since 8.6.0 * @example * hiddenPopupWindow: true */ hiddenPopupWindow?: boolean; /** * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations. * Any request inside WebView to a URL with a host matching any of these patterns will be blocked. * Supports wildcard patterns like: * - "*.example.com" to block all subdomains * - "www.example.*" to block wildcard domain extensions * * @since 7.17.0 * @default [] * @example * blockedHosts: ["*.tracking.com", "ads.example.com"] */ blockedHosts?: string[]; /** * Width of the webview in screen/window points. * If not set, webview will be fullscreen width. * @default undefined (fullscreen) * @example * width: 400 */ width?: number; /** * Height of the webview in screen/window points. * Required for custom-sized (non-fullscreen) webviews. * @default undefined (fullscreen) * @example * height: 600 */ height?: number; /** * X position of the webview in screen/window points from the left edge. * Only effective when custom height is set. * @default 0 * @example * x: 50 */ x?: number; /** * Y position of the webview in screen/window points from the top edge. * Only effective when custom height is set. * @default 0 * @example * y: 100 */ y?: number; /** * Places the native browser behind the Capacitor host WebView. * Make the app background transparent to reveal it, or rely on `transparentBackground` to clear the host WebView. * * @default false */ toBack?: boolean; /** * When `toBack` is true, makes the Capacitor host WebView transparent so the native browser can be seen behind Ionic content. * Ignored when the browser is in front. * * @default true */ transparentBackground?: boolean; /** * Disables the bounce (overscroll) effect on iOS WebView. * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries. * This is useful for: * - Creating a more native, app-like experience * - Preventing accidental overscroll states * - Avoiding issues when keyboard opens/closes * * Note: This option only affects iOS. Android does not have this bounce effect by default. * * @since 8.0.2 * @default false * @example * disableOverscroll: true */ disableOverscroll?: boolean; /** * Opens the webview in hidden mode (not visible to user but fully functional). * When hidden, the webview loads and executes JavaScript but is not displayed. * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden. * Use close() to clean up the hidden webview when done. * * @since 8.0.7 * @default false * @example * hidden: true */ hidden?: boolean; /** * Controls how a hidden webview reports its visibility and size. * - AWARE: webview is aware it's hidden (dimensions may be zero). * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible). * * @default InvisibilityMode.AWARE * @example * invisibilityMode: InvisibilityMode.FAKE_VISIBLE */ invisibilityMode?: InvisibilityMode; } export interface DimensionOptions { /** * Width of the webview in pixels */ width?: number; /** * Height of the webview in pixels */ height?: number; /** * X position from the left edge in pixels */ x?: number; /** * Y position from the top edge in pixels */ y?: number; } export interface InAppBrowserPlugin { /** * Navigates back in the WebView's history if possible * * @since 7.21.0 * @returns Promise that resolves with true if navigation was possible, false otherwise */ goBack(options?: { id?: string; }): Promise<{ canGoBack: boolean; }>; /** * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController * * @since 0.1.0 */ open(options: OpenOptions): Promise<any>; /** * Clear cookies of url * When `id` is omitted, applies to all open webviews. * * @since 0.5.0 */ clearCookies(options: ClearCookieOptions): Promise<any>; /** * Clear all cookies * When `id` is omitted, applies to all open webviews. * * @since 6.5.0 */ clearAllCookies(options?: { id?: string; }): Promise<any>; /** * Clear cache * When `id` is omitted, applies to all open webviews. * * @since 6.5.0 */ clearCache(options?: { id?: string; }): Promise<any>; /** * Clear all browsing data from InAppBrowser-managed webviews and the plugin-owned data store. * * This removes cookies, disk cache, memory cache, local storage, session storage, IndexedDB, * WebSQL where supported, form data, and HTTP auth data for InAppBrowser only. * * It does **not** clear the Capacitor/Ionic host WebView stores. On iOS 17+, InAppBrowser uses a * dedicated persistent `WKWebsiteDataStore` so host and browser data stay isolated (unless * `useSharedDataStore: true` was set on `openWebView`). On Android, process-global `CookieManager` * / `WebStorage` are shared with the host WebView and are not wiped by this method; open managed * WebViews still clear per-view cache/history and page storage. * * @since 8.6.36 */ clearAllBrowsingData(): Promise<any>; /** * Get cookies for a specific URL. * @param options The options, including the URL to get cookies for. * @returns A promise that resolves with the cookies. */ getCookies(options: GetCookieOptions): Promise<Record<string, string>>; /** * Close the webview. * When `id` is omitted, closes the active webview. */ close(options?: CloseWebviewOptions): Promise<any>; /** * Hide the webview without closing it. * Use show() to bring it back. * When `id` is omitted, targets the active webview. * * @since 8.0.8 */ hide(options?: { id?: string; }): Promise<void>; /** * Show a previously hidden webview. * When `id` is omitted, targets the active webview. * * @since 8.0.8 */ show(options?: { id?: string; }): Promise<void>; /** * Moves the native browser behind the Capacitor host WebView. * Use `dispatchInputEvent()` to forward overlay gestures to the browser while it is behind the app UI. */ sendToBack(options?: LayerOptions): Promise<void>; /** * Moves a browser that was behind the host WebView back to the front. * On iOS, set `isAnimated` to `false` to skip the presentation animation. * When `id` is omitted, targets the active webview. */ bringToFront(options?: BringToFrontOptions): Promise<void>; /** * Dispatches a click, touch, or scroll event to a managed browser. * Coordinates are relative to the browser viewport in CSS pixels. */ dispatchInputEvent(options: DispatchInputEventOptions): Promise<void>; /** * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc. * * JavaScript Interface: * When you open a webview with this method, a JavaScript interface is automatically injected that provides: * - `window.mobileApp.close()`: Closes the webview from JavaScript * - `window.mobileApp.postMessage({detail: {message: "myMessage"}})`: Sends a message from the webview to the app, detail object is the data you want to send to the webview * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true * * Promise timing differs by platform when `isPresentAfterPageLoad` is used. * Android resolves with `{ id }` after the dialog is ready to control, while iOS resolves with `{ id }` immediately after creating the native webview. * * @returns Promise that resolves with the created webview id. * @since 0.1.0 */ openWebView(options: OpenWebViewOptions): Promise<{ id: string; }>; /** * Injects JavaScript code into the InAppBrowser window. * When `id` is omitted, executes in all open webviews. */ executeScript(options: { code: string; id?: string; }): Promise<void>; /** * Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addEventListener("messageFromNative", listenerFunc: (event: Record<string, any>) => void) * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed. * When `id` is omitted, broadcasts to all open webviews. */ postMessage(options: { detail: Record<string, any>; id?: string; }): Promise<void>; /** * Captures the current webview viewport as a PNG screenshot. * When `id` is omitted, targets the active webview. * * On iOS, when testing through Apple's iPhone Mirroring app with the physical * device locked, the snapshot can succeed with the correct dimensions but a * fully transparent PNG. Capture works as expected on a normal unlocked device. */ takeScreenshot(options?: { id?: string; }): Promise<ScreenshotResult>; /** * Sets the URL of the webview. * When `id` is omitted, targets the active webview. */ setUrl(options: { url: string; id?: string; }): Promise<any>; /** * Listen for url change, only for openWebView * * @since 0.0.1 */ addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>; /** * Listen for buttonNearDone clicks. * * The event payload contains the webview `id`. * * @since 0.0.1 */ addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>; /** * Listen for close click only for openWebView * * @since 0.4.0 */ addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>; /** * Listen for webviews hidden by the toolbar close button when closeAction is CloseAction.HIDE. * * @since 8.7.7 */ addListener(eventName: 'hideEvent', listenerFunc: HideListener): Promise<PluginListenerHandle>; /** * Will be triggered when user clicks on confirm button when disclaimer is required, * works with openWebView shareDisclaimer and closeModal * * @since 0.0.1 */ addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): Promise<PluginListenerHandle>; /** * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ "detail": { "message": "myMessage" } }) * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed. * * This method is inject at runtime in the webview */ addListener(eventName: 'messageFromWebview', listenerFunc: (event: { id?: string; detail?: Record<string, any>; rawMessage?: string; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered whenever a screenshot is captured from the plugin API, * the native screenshot button, or the injected JavaScript bridge. */ addListener(eventName: 'screenshotTaken', listenerFunc: (event: ScreenshotResult & { id?: string; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered when page is loaded */ addListener(eventName: 'browserPageLoaded', listenerFunc: (event: { id?: string; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered when a main-frame page load starts (link navigation, reload, etc.). * * @since 8.11.0 */ addListener(eventName: 'browserPageLoadStart', listenerFunc: (event: { id?: string; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered as a main-frame page load progresses. * `progress` is a value from `0` to `1`. * * @since 8.11.0 */ addListener(eventName: 'browserPageLoadProgress', listenerFunc: (event: { id?: string; progress: number; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered when page load error */ addListener(eventName: 'pageLoadError', listenerFunc: (event: { id?: string; }) => void): Promise<PluginListenerHandle>; /** * Will be triggered when the webview intercepts a non-standard custom scheme * and hands it to the operating system. * * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded. * * @since 8.6.7 */ addListener(eventName: 'customSchemeIntercepted', listenerFunc: CustomSchemeInterceptedListener): Promise<PluginListenerHandle>; /** * Will be triggered after native download handling saves a file locally. * Enable this with `handleDownloads: true` when opening the webview. * * @since 8.6.0 */ addListener(eventName: 'downloadCompleted', listenerFunc: (event: DownloadCompletedEvent) => void): Promise<PluginListenerHandle>; /** * Will be triggered when native download handling fails. * Enable this with `handleDownloads: true` when opening the webview. * * @since 8.6.0 */ addListener(eventName: 'downloadFailed', listenerFunc: (event: DownloadFailedEvent) => void): Promise<PluginListenerHandle>; /** * Will be triggered whenever a page opens a popup/new window. * Use the returned popup id with `executeScript`, `postMessage`, `show`, `hide`, and `close`. * * @since 8.6.0 */ addListener(eventName: 'popupWindowOpened', listenerFunc: (event: PopupWindowEvent) => void): Promise<PluginListenerHandle>; /** * Listen for proxied requests delegated by the native runtime. * Prefer `addProxyHandler()` instead of calling this directly. * * @since 8.6.0 */ addListener(eventName: 'proxyRequest', listenerFunc: (event: ProxyRequest) => void): Promise<PluginListenerHandle>; /** * Listen for JavaScript console output emitted by the managed page. * Enable this with `captureConsoleLogs: true` when opening the webview. * * @since 8.6.0 */ addListener(eventName: 'consoleMessage', listenerFunc: (event: ConsoleMessageEvent) => void): Promise<PluginListenerHandle>; /** * Internal method used by `addProxyHandler()` to send a proxy decision back to native. * Forward the original `phase` when replying to a manual `proxyRequest` listener. * * @since 8.6.0 */ handleProxyRequest(options: { requestId: string; decision?: ProxyDecision | null; response?: ProxyResponse | null; webviewId?: string; phase?: 'outbound' | 'inbound'; }): Promise<void>; /** * Remove all listeners for this plugin. * * @since 1.0.0 */ removeAllListeners(): Promise<void>; /** * Reload the current web page. * * @since 1.0.0 */ reload(options?: { id?: string; }): Promise<any>; /** * Update the dimensions of the webview. * Allows changing the size and position of the webview at runtime. * When `id` is omitted, targets the active webview. * * @param options Dimension options (width, height, x, y) * @returns Promise that resolves when dimensions are updated */ updateDimensions(options: DimensionOptions & { id?: string; }): Promise<void>; /** * Sets the enabled safe top margin of the webview at runtime. * When `id` is omitted, targets the active webview. * On Web, this method is a no-op and resolves without changing layout. */ setEnabledSafeTopMargin(options: { enabled: boolean; id?: string; }): Promise<void>; /** * Sets the enabled safe bottom margin of the webview at runtime. * When `id` is omitted, targets the active webview. * On Web, this method is a no-op and resolves without changing layout. */ setEnabledSafeBottomMargin(options: { enabled: boolean; id?: string; }): Promise<void>; /** * Opens a secured window for OAuth2 authentication. * * On web, the redirect page should post the final URL to a `BroadcastChannel` and close itself. * On mobile, register a custom redirect URI scheme (for example `myapp://oauth_callback/`) in Info.plist and AndroidManifest.xml. * See the README section "openSecureWindow (OAuth)" for full setup examples. * * @param options - the options for the openSecureWindow call */ openSecureWindow(options: OpenSecureWindowOptions): Promise<OpenSecureWindowResponse>; } /** * JavaScript APIs available in the InAppBrowser WebView. * * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView. * * @example * // Closing the webview from JavaScript * window.mobileApp.close(); * * // Sending a message from webview to the native app * window.mobileApp.postMessage({ key: "value" }); * * @since 6.10.0 */ export interface InAppBrowserWebViewAPIs { /** * mobileApp - Global object injected into the WebView providing communication with the native app */ mobileApp: { /** * Close the WebView from JavaScript * * @example * // Add a button to close the webview * const closeButton = document.createElement("button"); * closeButton.textContent = "Close WebView"; * closeButton.addEventListener("click", () => { * window.mobileApp.close(); * }); * document.body.appendChild(closeButton); * * @since 6.10.0 */ close(): void; /** * Send a message from the WebView to the native app * The native app can listen for these messages with the "messageFromWebview" event * * @param message Object to send to the native app * @example * // Send data to native app * window.mobileApp.postMessage({ * action: "dataSubmitted", * data: { username: "test", email: "test@example.com" } * }); * * @since 6.10.0 */ postMessage(message: Record<string, any>): void; /** * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig) * * @since 8.0.8 */ hide(): void; /** * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig) * * @since 8.0.8 */ show(): void; /** * Capture the current WebView viewport as a PNG screenshot. * Requires `allowScreenshotsFromWebPage` to be enabled when opening the webview. * * @since 8.4.0 */ takeScreenshot(): Promise<ScreenshotResult>; }; /** * Get the native Capacitor plugin version * * @returns {Promise<{ id: string }>} an Promise with version for this device * @throws An error if the something went wrong */ getPluginVersion(): Promise<{ version: string; }>; }