@capgo/capacitor-inappbrowser
Capacitor plugin in app browser.
Overview
Section titled “Overview”Capacitor plugin in app browser.
Package name changed.Core Capabilities
Section titled “Core Capabilities”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 Whenidis omitted, applies to all open webviews.clearAllCookies- Clear all cookies Whenidis omitted, applies to all open webviews.
Public API
Section titled “Public API”| Method | Description |
|---|---|
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. |
clearCache | Clear cache When id is omitted, applies to all open webviews. |
getCookies | Get cookies for a specific URL. |
close | Close the webview. When id is omitted, closes the active webview. |
hide | Hide the webview without closing it. Use show() to bring it back. When id is omitted, targets the active webview. |
show | Show a previously hidden webview. When id is omitted, targets the active webview. |
openWebView | Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc. |
executeScript | Injects JavaScript code into the InAppBrowser window. When id is omitted, executes in all open webviews. |
postMessage | Sends 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. |
takeScreenshot | Captures the current webview viewport as a PNG screenshot. When id is omitted, targets the active webview. |
setUrl | Sets the URL of the webview. When id is omitted, targets the active webview. |
addListener | Listen for url change, only for openWebView. |
addListener | See the source definitions for current behavior. |
addListener | Listen for close click only for openWebView. |
addListener | Will be triggered when user clicks on confirm button when disclaimer is required, works with openWebView shareDisclaimer and closeModal. |
addListener | Fires when the webview sends an event back to the app. Use window.mobileApp.postMessage(...) in the page, and keep the payload JSON-serializable. |
addListener | Will be triggered whenever a screenshot is captured from the plugin API, the native screenshot button, or the injected JavaScript bridge. |
addListener | Will be triggered when page is loaded. |
addListener | Will be triggered when page load error. |
addListener | Will be triggered after native download handling saves a file locally. Enable this with handleDownloads: true when opening the webview. |
addListener | Will be triggered when native download handling fails. Enable this with handleDownloads: true when opening the webview. |
addListener | Will be triggered whenever a page opens a popup/new window. Use the returned popup id with executeScript, postMessage, show, hide, and close. |
addListener | Listen for proxied requests delegated by the native runtime. Prefer addProxyHandler() instead of calling this directly. |
addListener | Listen for JavaScript console output emitted by the managed page. Enable this with captureConsoleLogs: true when opening the webview. |
handleProxyRequest | Internal method used by addProxyHandler() to send a proxy decision back to native. Forward the original phase when replying to a manual proxyRequest listener. |
removeAllListeners | Remove all listeners for this plugin. |
reload | Reload the current web page. |
updateDimensions | 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. |
setEnabledSafeTopMargin | 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. |
setEnabledSafeBottomMargin | 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. |
openSecureWindow | Opens 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. |
Source Of Truth
Section titled “Source Of Truth”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.