Skip to content

@capgo/capacitor-inappbrowser

Native in-app browser for Capacitor with managed WebViews, native UI layering, private sessions, proxying, downloads, popups, and app messaging.

@capgo/capacitor-inappbrowser gives Capacitor apps two browser paths: open() for the system browser experience and openWebView() for a managed native WebView that your app can size, hide, message, script, proxy, and layer with Ionic UI.

Use it when the page needs more than a simple external browser: OAuth and checkout flows, embedded support portals, payment screens, video calls, document portals, interactive web apps, or any flow where your app needs native controls around live web content.

Package name changed.
  • Present Ionic or Capacitor UI above a live browser page with toBack, sendToBack(), bringToFront(), transparentBackground, and dispatchInputEvent().
  • Build partial-screen browsers, bottom sheets, and picture-in-picture webviews with width, height, x, y, and updateDimensions().
  • Let users tap the Capacitor app outside a custom-size browser frame on Android and iOS.
  • Run checkout, login, support, or account-switching flows without persistent website storage using persistWebViewData: false and clearAllBrowsingData().
  • Keep multiple browser instances loaded with hidden, hide(), and show() while preserving page state.
  • Embed advanced web apps that need request proxying, file uploads, downloads, popup control, Google Pay support, _blank link handling, and app-to-page messaging.
  • open - Opens a URL in Chrome Custom Tabs on Android or SFSafariViewController on iOS.
  • openWebView - Opens a managed native WebView with custom toolbar, sizing, native navigation, messaging, scripting, proxy, downloads, popups, and data controls.
  • sendToBack / bringToFront - Moves a managed browser behind or above the Capacitor host WebView.
  • dispatchInputEvent - Forwards click, touch, and scroll events to a browser that is behind native app UI.
  • updateDimensions - Changes the managed WebView size and position without reloading the page.
  • hide / show - Keeps managed WebViews loaded while removing or restoring their native presentation.
  • postMessage / executeScript - Connects the Capacitor app with JavaScript running inside the managed page.
  • clearAllBrowsingData / persistWebViewData - Controls cookie, cache, storage, IndexedDB, and session persistence.
  • handleDownloads, proxy rules, and popup events - Support document portals, upload flows, payment pages, and embedded web apps.
MethodDescription
goBackNavigates back in the WebView’s history if possible.
openOpen url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController.
clearCookiesClear cookies of url When id is omitted, applies to all open webviews.
clearAllCookiesClear all cookies When id is omitted, applies to all open webviews.
clearCacheClear cache When id is omitted, applies to all open webviews.
clearAllBrowsingDataClears cookies, cache, local storage, session storage, IndexedDB, and other browsing data from the default store and managed WebViews.
getCookiesGet cookies for a specific URL.
closeClose the webview. When id is omitted, closes the active webview.
hideHide the webview without closing it. Use show() to bring it back. When id is omitted, targets the active webview.
showShow a previously hidden webview. When id is omitted, targets the active webview.
sendToBackMoves the native browser behind the Capacitor host WebView so app UI can appear above it.
bringToFrontMoves a browser that was behind the host WebView back to the front.
dispatchInputEventDispatches click, touch, or scroll input to a managed browser; coordinates are relative to the browser viewport.
openWebViewOpen url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.
executeScriptInjects JavaScript code into the InAppBrowser window. When id is omitted, executes in all open webviews.
postMessageSends an event to the webview (in-app browser). Listen in the page with window.addEventListener('messageFromNative', listenerFunc). The detail payload must be JSON-serializable. When id is omitted, broadcasts to all open webviews.
takeScreenshotCaptures the current webview viewport as a PNG screenshot. When id is omitted, targets the active webview.
setUrlSets the URL of the webview. When id is omitted, targets the active webview.
addListenerListen for url change, only for openWebView.
addListenerListen for buttonNearDoneClick; the payload contains the webview id.
addListenerListen for close click only for openWebView.
addListenerWill be triggered when user clicks on confirm button when disclaimer is required, works with openWebView shareDisclaimer and closeModal.
addListenerFires when the webview sends an event back to the app. Use window.mobileApp.postMessage(...) in the page, and keep the payload JSON-serializable.
addListenerWill be triggered whenever a screenshot is captured from the plugin API, the native screenshot button, or the injected JavaScript bridge.
addListenerWill be triggered when page is loaded.
addListenerWill be triggered when page load error.
addListenerWill be triggered after native download handling saves a file locally. Enable this with handleDownloads: true when opening the webview.
addListenerWill be triggered when native download handling fails. Enable this with handleDownloads: true when opening the webview.
addListenerWill be triggered whenever a page opens a popup/new window. Use the returned popup id with executeScript, postMessage, show, hide, and close.
addListenerListen for proxied requests delegated by the native runtime. Prefer addProxyHandler() instead of calling this directly.
addListenerListen for JavaScript console output emitted by the managed page. Enable this with captureConsoleLogs: true when opening the webview.
handleProxyRequestInternal method used by addProxyHandler() to send a proxy decision back to native. Forward the original phase when replying to a manual proxyRequest listener.
removeAllListenersRemove all listeners for this plugin.
reloadReload the current web page.
updateDimensionsUpdate the dimensions of the webview. Allows changing the size and position of the webview at runtime. When id is omitted, targets the active webview.
setEnabledSafeTopMarginSets 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.
setEnabledSafeBottomMarginSets 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.
openSecureWindowOpens a secure OAuth2 window. On web, return the redirected URL through a BroadcastChannel; on mobile, register a custom redirect URI in your app configuration. See the getting-started guide for the full HTML, Info.plist, and AndroidManifest examples.

This reference is synced from src/definitions.ts in capacitor-inappbrowser.

Keep going from @capgo/capacitor-inappbrowser

Section titled “Keep going from @capgo/capacitor-inappbrowser”

If you are using @capgo/capacitor-inappbrowser to plan native plugin work, connect it with Using @capgo/capacitor-inappbrowser for the native capability in Using @capgo/capacitor-inappbrowser, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, and Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives.