시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사할 수 있습니다.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-inappbrowser`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/inappbrowser/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치하기
설치 제목AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 프롬프트를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-inappbrowser` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하여 플랫폼에 따라 아래의 지침을 따르세요.
npm install @capgo/capacitor-inappbrowsernpx cap syncImport
Import 섹션import { InAppBrowser } from '@capgo/capacitor-inappbrowser';브라우저 모드를 선택하세요
브라우저 모드 선택 섹션사용할 때 플랫폼 브라우저 표면이 필요합니다: 안드로이드의 Chrome Custom Tabs와 open() iOS에서. 사용 SFSafariViewController when you want the platform browser surface: Chrome Custom Tabs on Android and openWebView() 앱이 네이티브 WebView를 제어할 때 필요할 때: 커스텀 사이즈, 툴바, 앱 메시징, 자바스크립트 주입, 다운로드, 프록시, 팝업, 숨겨진 인스턴스 또는 UI 레이어링.
일반적인 사용 사례
일반적인 사용 사례Ionic UI를 라이브 브라우저 페이지 위에 표시하기
일반적인 사용 사례관리되는 WebView를 Capacitor 호스트 WebView 뒤에 열어보세요. toBackIonic UI는 페이지가 로드된 상태에서 위에 렌더링할 수 있습니다. forward gestures를 브라우저로 전달하세요. dispatchInputEvent() overlay가 페이지와 상호작용할 때.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
const { id } = await InAppBrowser.openWebView({ url: 'https://example.com/checkout', toBack: true, transparentBackground: true,});
await InAppBrowser.dispatchInputEvent({ id, type: 'click', x: 160, y: 420,});
await InAppBrowser.bringToFront({ id });브라우저가 표시될 때 앱 배경을 투명하게 만드세요. 브라우저가 앱 뒤에 있을 때, 네이티브 제스처는 Capacitor WebView가 소유하고 있으나, 명시적으로 전달하지 않으면 여전히 소유합니다.
부분 화면 브라우저 또는 하단 시트를 빌드하세요
부분 화면 브라우저 또는 하단 시트설정 height, width, x, 그리고 y Capacitor 앱의 일부를 네이티브 브라우저 주변에 보이도록 유지하세요. 안드로이드와 iOS에서 브라우저 프레임 외부의 터치 이벤트는 underlying Capacitor WebView로 전달됩니다.
const bottomGap = 200;
const { id } = await InAppBrowser.openWebView({ url: 'https://example.com/offers', height: window.innerHeight - bottomGap, y: 0,});
await InAppBrowser.updateDimensions({ id, height: window.innerHeight, y: 0,});이것을 미니 브라우저, 오퍼 패널, 지원 위젯, 브라우저 백드롭 시트, 또는 네이티브 앱 컨트롤이 웹 콘텐츠 외부에서 클릭할 수 있도록 유지해야 하는 모든 흐름에 사용하세요.
체크아웃, 인증, 또는 지원 세션을 개인적으로 유지하세요
체크아웃, 인증, 또는 지원 세션을 개인적으로 유지하세요설정 persistWebViewData: false 관리형 WebView에 대해 지속적인 웹사이트 데이터를 피하기 위해 지원되는 플랫폼에서 사용하세요. 로그아웃, 계정switching, 테스트 세션, 또는 기본 저장소와 열린 관리형 WebView를 지우는 흐름에서 호출하세요. clearAllBrowsingData() 클립보드 복사
const { id } = await InAppBrowser.openWebView({ url: 'https://example.com/login', persistWebViewData: false,});
await InAppBrowser.clearAllBrowsingData();await InAppBrowser.close({ id });__CAPGO_KEEP_0__ clearAllBrowsingData() 쿠키와 다른 공유 브라우저 데이터의 정리 단계입니다.
다중 브라우저 인스턴스를 준비하세요.
다중 브라우저 인스턴스를 준비하세요사용 hidden, hide(), 그리고 show() 프리로드 또는 관리된 WebView를 각각 화면에 유지하지 않고 여러 개를 보존하기 위해 사용합니다. 숨겨진 WebView는 여전히 executeScript(), postMessage(), setUrl(), 그리고
const first = await InAppBrowser.openWebView({ url: 'https://example.com/a', hidden: true });const second = await InAppBrowser.openWebView({ url: 'https://example.com/b', hidden: true });
await InAppBrowser.show({ id: first.id });await InAppBrowser.hide({ id: first.id });await InAppBrowser.show({ id: second.id });고급 웹 앱 흐름을 삽입
Section titled “고급 웹 앱 흐름을 삽입”프록시 규칙을 combine handleDownloads, openBlankTargetInWebView, hiddenPopupWindow, enableGooglePaySupport, postMessage(), 그리고 executeScript() 문서 포털, 업로드 흐름, 결제 페이지, 지원 데스크 및 다른 임베디드 웹 앱에 native 제어를 제공하기 위해 앱을 떠나지 않고 사용할 수 있습니다.
const { id } = await InAppBrowser.openWebView({ url: 'https://example.com/portal', handleDownloads: true, openBlankTargetInWebView: true, hiddenPopupWindow: true, outboundProxyRules: [ { urlRegex: '^https://example\\.com/api/', action: 'delegateToJs', }, ],});
await InAppBrowser.postMessage({ id, detail: { source: 'app', action: 'refresh' },});API 개요
API 개요 제목goBack
__CAPGO_KEEP_0__ 뒤로웹뷰의 히스토리에서 뒤로가기 가능합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.goBack();URL을 새 창에서 풀스크린으로 열기, 안드로이드에서는 Chrome Custom Tabs를 사용하고, iOS에서는 SFSafariViewController를 사용합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.open({} as OpenOptions);clearCookies
__CAPGO_KEEP_0__ 쿠키 지우기URL의 쿠키 지우기
id 생략 시 모든 열려 있는 웹 뷰에 적용됩니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.clearCookies({} as ClearCookieOptions);clearAllCookies
clearAllCookies쿠키 모두 삭제
언제 id 생략 시 모든 열려 있는 웹 뷰에 적용됩니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.clearAllCookies();clearCache
clearCache캐시 모두 삭제
언제 id 클립보드 복사
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.clearCache();clearAllBrowsingData
기본 저장소와 열려 있는 관리형 웹 뷰에서 모든 브라우징 데이터를 삭제합니다. 이에는 쿠키, 캐시, 로컬 스토리지, 세션 스토리지, IndexedDB, 폼 데이터 및 HTTP 인증 데이터가 포함됩니다. 플랫폼이 노출하는 경우에만.클립보드 복사
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.clearAllBrowsingData();getCookies
쿠키 가져오기특정 URL에 대한 쿠키를 가져옵니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.getCookies({} as GetCookieOptions);close
닫기웹뷰를 닫습니다.
is가 생략되면 현재 활성화된 웹뷰를 닫습니다. id 복사
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.close();복사 id protectedTokens
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.hide();웹뷰를 다시 표시합니다.
When id omitted되면 현재 활성화된 웹뷰를 대상으로합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.show();sendToBack
Section titled “sendToBack”Moves the native browser behind the Capacitor host WebView. Use this when your Ionic UI should appear above a live browser page.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.sendToBack({ id: 'webview-id', transparentBackground: true });bringToFront
Section titled “bringToFront”호스트 WebView 뒤로 가 있던 브라우저를 다시 앞으로 이동합니다. When id omitted되면 현재 활성화된 웹뷰를 대상으로합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.bringToFront({ id: 'webview-id' });dispatchInputEvent
Section titled “dispatchInputEvent”Dispatches a click, touch, 또는 scroll 이벤트를 관리 브라우저에 전송합니다. 좌표는 CSS 픽셀 단위로 브라우저 뷰포트에 상대적입니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.dispatchInputEvent({ id: 'webview-id', type: 'click', x: 160, y: 420,});openWebView
‘openWebView’ 섹션기기에서 열기
URL을 새로운 웹뷰에서 열기, 도구栏, 카메라 접근, 파일 접근, 이벤트 듣기, 자바스크립트 주입, 양방향 통신 등 향상된 기능이 있습니다.
window.mobileApp.close()JavaScript 인터페이스: 이 메서드를 사용하여 웹뷰를 열 때 자동으로 주입되는 JavaScript 인터페이스는 다음과 같은 기능을 제공합니다.window.mobileApp.postMessage({detail: {message: "myMessage"}})웹뷰를 JavaScript에서 닫습니다.window.mobileApp.takeScreenshot()웹뷰에서 앱으로 메시지를 보냅니다. detail 객체는 웹뷰로 보낼 데이터입니다.allowScreenshotsFromWebPagewhen
true isPresentAfterPageLoad when이 사용될 때, Promise의 타이밍은 플랫폼에 따라 다릅니다. { id } Android는 대화가 준비되면 resolve합니다. iOS는 대화가 준비되면 resolve합니다. { id } 생성한 네이티브 웹뷰 바로 뒤에.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.openWebView({} as OpenWebViewOptions);executeScript
executeScriptInAppBrowser 창에 자바스크립트 code를 주입합니다.
When id 생략하면 모든 열린 웹뷰에서 실행됩니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.executeScript({} as { code: string; id?: string });postMessage
postMessage웹뷰(인앱 브라우저)로 이벤트를 보냅니다. 웹뷰 자바스크립트에서 이 이벤트를 listen 하려면 window.addEventListener('messageFromNative', listenerFunc).
detail 웹뷰로 보낸 데이터입니다. Capacitor를 건너편으로 건너갈 때 JSON-serializable 해야 합니다.
When id 생략하면 모든 열린 웹뷰에 방송됩니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.postMessage({} as { detail: Record<string, any>; id?: string });takeScreenshot
takeScreenshot현재 웹뷰 뷰포트를 PNG 스크린샷으로 캡처합니다.
id omitted일 때는 활성 웹뷰를 대상으로합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.takeScreenshot();클립보드에 복사 id Proxy 요청을 처리합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.setUrl({} as { url: string; id?: string });handleProxyRequest
native로 proxy 결정 결과를 전송합니다.
수동 addProxyHandler() 리스너에 대한 원본을 전달합니다. phase __CAPGO_KEEP_0__ proxyRequest __CAPGO_KEEP_0__
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.handleProxyRequest({} as { requestId: string; decision?: ProxyDecision | null; response?: ProxyResponse | null; webviewId?: string; phase?: 'outbound' | 'inbound'; });reload
재로드현재 웹 페이지를 재로드하세요.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.reload();updateDimensions
크기 및 위치를 변경할 수 있는 웹뷰 크기 및 위치를 업데이트합니다.크기 및 위치를 변경할 수 있는 웹뷰 크기 및 위치를 업데이트합니다.
런타임에 크기 및 위치를 변경할 수 있습니다.
omitted일 때, 활성 웹뷰를 대상으로합니다. id 클립보드 복사
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.updateDimensions({} as DimensionOptions & { id?: string });setEnabledSafeTopMargin
클립보드 복사크기 및 위치를 변경할 수 있는 웹뷰 크기 및 위치를 업데이트합니다. id 활성화된 위쪽 마진을 설정합니다.
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.setEnabledSafeTopMargin({} as { enabled: boolean; id?: string });setEnabledSafeBottomMargin
setEnabledSafeBottomMargin웹뷰의 활성화된 안전 하단 여백을 런타임에 설정합니다.
omitted일 때는 활성화된 웹뷰를 대상으로합니다.
웹에서 이 메서드는 레이아웃 변경없이 무시됩니다. id 복사
import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.setEnabledSafeBottomMargin({} as { enabled: boolean; id?: string });openSecureWindow
OAuth2 인증을위한 보안 창을 열습니다.
웹에서, __CAPGO_KEEP_0__이 리다이렉트된 페이지에 있어야 리다이렉트된 URL을 앱으로 보내기 위해 브로드캐스트 채널을 사용할 수 있습니다.
예를 들어:Opens a secured window for OAuth2 authentication. For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app Something like:
<html><head></head><body><script> const searchParams = new URLSearchParams(location.search) if (searchParams.has("code")) { new BroadcastChannel("my-channel-name").postMessage(location.href); window.close(); }</script></body></html>복사 myapp://oauth_callback/
앱의 info.plist에 등록해야합니다.
<key>CFBundleURLTypes</key><array> <dict> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict></array>AndroidManifest.xml 파일에 등록해야합니다.
<activity> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="oauth_callback" android:scheme="myapp" /> </intent-filter></activity>import { InAppBrowser } from '@capgo/capacitor-inappbrowser';
await InAppBrowser.openSecureWindow({} as OpenSecureWindowOptions);타입 참조
타입 참조 섹션OpenOptions
OpenOptions 섹션export interface OpenOptions { /** * Target URL to load. * @since 0.1.0 */ 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;
// --- Chrome Custom Tab customization (Android only, ignored on iOS) ---
/** * 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 <title> 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;}ClearCookieOptions
ClearCookieOptions 섹션export interface ClearCookieOptions { /** * Target webview id. * When omitted, applies to all open webviews. */ id?: string; url: string;}GetCookieOptions
GetCookieOptions 섹션export interface GetCookieOptions { url: string; includeHttpOnly?: boolean;}CloseWebviewOptions
CloseWebviewOptions 섹션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;}LayerOptions
LayerOptions 섹션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;}DispatchInputEventOptions
DispatchInputEventOptions 섹션export type WebViewPointerInputEventType = 'click' | 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';export type WebViewInputEventType = WebViewPointerInputEventType | 'scroll';
export interface DispatchPointerInputEventOptions { id?: string; type: WebViewPointerInputEventType; x: number; y: number;}
export interface DispatchScrollInputEventOptions { id?: string; type: 'scroll'; x: number; y: number; deltaX: number; deltaY: number;}
export type DispatchInputEventOptions = DispatchPointerInputEventOptions | DispatchScrollInputEventOptions;OpenWebViewOptions
OpenWebViewOptions 섹션export interface OpenWebViewOptions { /** * Target URL to load. * @since 0.1.0 * @example "https://capgo.app" */ 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; /** * 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; // This property doesn't exist, it's just for documentation /** * 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 * DOM/database storage where the system WebView supports it. Android cookies use the shared * WebView cookie store, so call `clearAllBrowsingData()` to remove cookies and other global data. * * @default true * @since 8.6.36 */ persistWebViewData?: 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; /** * 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; /** * 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; /** * 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; /** * 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; /** * preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work. * @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 HTTPS links whose host matches any entry in this list * will attempt to open via the corresponding native application. * - If the app is not installed or the system cannot handle the link, the URL * will continue loading inside the in-app browser. * - Matching is host-based (case-insensitive), ignoring the "www." prefix. * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list. * * @example * ```ts * ["https://example.com", "https://subdomain.app.io"] * ``` * * @since 7.12.0 * @default [] */ authorizedAppLinks?: string[];
/** * If true, the webView will not take the full height and will have a 20px margin at the bottom. * This creates a safe margin area outside the browser view. * @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. * @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 as the WebView top margin on Android. * Keeps the legacy 0px margin by default for apps that handle padding themselves. * @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 pixels. * If not set, webview will be fullscreen width. * @default undefined (fullscreen) * @example * width: 400 */ width?: number;
/** * Height of the webview in pixels. * If not set, webview will be fullscreen height. * @default undefined (fullscreen) * @example * height: 600 */ height?: number;
/** * X position of the webview in pixels from the left edge. * Only effective when width is set. * @default 0 * @example * x: 50 */ x?: number;
/** * Y position of the webview in pixels from the top edge. * Only effective when 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;}ScreenshotResult
ScreenshotResult 섹션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;}UrlChangeListener
UrlChangeListener 섹션export type UrlChangeListener = (state: UrlEvent) => void;ButtonNearDoneEvent
ButtonNearDoneEvent 섹션export interface ButtonNearDoneEvent { /** * Webview instance id. * * @since 8.6.36 */ id: string;}ButtonNearListener
ButtonNearListener 섹션export type ButtonNearListener = (state: ButtonNearDoneEvent) => void;ConfirmBtnListener
ConfirmBtnListenerexport type ConfirmBtnListener = (state: BtnEvent) => void;DownloadCompletedEvent
다운로드 완료 이벤트다운로드가 로컬로 저장된 후에 발생하는 이벤트입니다.
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;}DownloadFailedEvent
다운로드 실패 이벤트다운로드 처리가 실패했을 때 발생하는 이벤트입니다.
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;}PopupWindowEvent
팝업 창 이벤트웹 페이지가 팝업 창/새 창을 열 때 발생하는 이벤트입니다.
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;}원본의 진실
‘원본의 진실’이라는 제목의 섹션이 페이지는 플러그인의 src/definitions.ts업스트림에서 API이 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
‘Getting Started에서 계속’이라는 제목의 섹션이 플러그인을 사용하는 경우 Getting Started 계획 대시보드 및 API 운영을 위해 Using @capgo/capacitor-inappbrowser Using @capgo/capacitor-inappbrowser API 개요 implementation 세부 정보를 위한 API Overview 소개 implementation 세부 정보를 위한 Introduction API Keys implementation 세부 정보를 위한 API Keys, 그리고 장치 implementation 세부 정보를 위한 Devices.