Skip to content

@capgo/inappbrowser

Capacitor plugin in app browser.

Capacitor plugin in app browser.

  • goBack - Navigates back in the WebView’s history if possible.
  • open - Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController.
  • clearCookies - Clear cookies of url When id is omitted, applies to all open webviews.
  • clearAllCookies - Clear all cookies When id is omitted, applies to all open webviews.
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.
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.
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.
addListenerSee the source definitions for current behavior.
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.