@capgo/inappbrowser 8.1.19 → 8.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,6 +94,24 @@ InAppBrowser.openWebView({
94
94
 
95
95
  Web platform is not supported. Use `window.open` instead.
96
96
 
97
+ ### Open WebView in Full Screen Mode
98
+
99
+ To open the webview in true full screen mode (content extends behind the status bar), set `enabledSafeTopMargin` to `false`:
100
+
101
+ ```js
102
+ import { InAppBrowser } from '@capgo/inappbrowser'
103
+
104
+ InAppBrowser.openWebView({
105
+ url: "YOUR_URL",
106
+ enabledSafeTopMargin: false // Disables safe area at top, allows full screen
107
+ });
108
+ ```
109
+
110
+ This option works independently of the toolbar type:
111
+ - **iOS**: The webview extends behind the status bar, providing true edge-to-edge content
112
+ - **Android**: The top margin is disabled, allowing content to fill the entire screen
113
+
114
+ Perfect for immersive experiences like video players, games, or full-screen web applications. Can be combined with any `toolbarType` setting.
97
115
 
98
116
  ### Test app and code:
99
117
 
@@ -775,6 +793,8 @@ And in the AndroidManifest.xml file:
775
793
  | **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
776
794
  | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
777
795
  | **`credentials`** | <code><a href="#credentials">Credentials</a></code> | <a href="#credentials">Credentials</a> to send with the request and all subsequent requests for the same host. | | 6.1.0 |
796
+ | **`method`** | <code>string</code> | 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 | <code>"GET"</code> | 8.2.0 |
797
+ | **`body`** | <code>string</code> | 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. | | 8.2.0 |
778
798
  | **`materialPicker`** | <code>boolean</code> | 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. | <code>false</code> | 7.4.1 |
779
799
  | **`jsInterface`** | | 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 | | 6.10.0 |
780
800
  | **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | 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 | | 0.1.0 |
@@ -806,6 +826,7 @@ And in the AndroidManifest.xml file:
806
826
  | **`preventDeeplink`** | <code>boolean</code> | 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. | <code>false</code> | 0.1.0 |
807
827
  | **`authorizedAppLinks`** | <code>string[]</code> | 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. | <code>[]</code> | 7.12.0 |
808
828
  | **`enabledSafeBottomMargin`** | <code>boolean</code> | 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. | <code>false</code> | 7.13.0 |
829
+ | **`enabledSafeTopMargin`** | <code>boolean</code> | 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. | <code>true</code> | 8.2.0 |
809
830
  | **`useTopInset`** | <code>boolean</code> | 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. | <code>false</code> | |
810
831
  | **`enableGooglePaySupport`** | <code>boolean</code> | 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 | <code>false</code> | 7.13.0 |
811
832
  | **`blockedHosts`** | <code>string[]</code> | 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 | <code>[]</code> | 7.17.0 |
@@ -52,7 +52,7 @@ repositories {
52
52
  dependencies {
53
53
  implementation fileTree(dir: 'libs', include: ['*.jar'])
54
54
  implementation project(':capacitor-android')
55
- implementation 'com.caverock:androidsvg:1.4'
55
+ implementation 'com.caverock:androidsvg-aar:1.4'
56
56
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
57
57
  implementation "androidx.window:window:1.5.1"
58
58
  testImplementation "junit:junit:$junitVersion"
@@ -55,7 +55,7 @@ import org.json.JSONObject;
55
55
  )
56
56
  public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
57
57
 
58
- private final String pluginVersion = "8.1.19";
58
+ private final String pluginVersion = "8.1.21";
59
59
 
60
60
  public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
61
61
  private CustomTabsClient customTabsClient;
@@ -624,6 +624,9 @@ public class InAppBrowserPlugin extends Plugin implements WebViewDialog.Permissi
624
624
  // Set enabledSafeBottomMargin option
625
625
  options.setEnabledSafeMargin(Boolean.TRUE.equals(call.getBoolean("enabledSafeBottomMargin", false)));
626
626
 
627
+ // Set enabledSafeTopMargin option (defaults to true for safe area)
628
+ options.setEnabledSafeTopMargin(call.getBoolean("enabledSafeTopMargin", true));
629
+
627
630
  // Use system top inset for WebView margin when explicitly enabled
628
631
  options.setUseTopInset(Boolean.TRUE.equals(call.getBoolean("useTopInset", false)));
629
632
 
@@ -770,6 +773,16 @@ public class InAppBrowserPlugin extends Plugin implements WebViewDialog.Permissi
770
773
  options.setAllowWebViewJsVisibilityControl(allowWebViewJsVisibilityControl);
771
774
  options.setInvisibilityMode(Options.InvisibilityMode.fromString(call.getString("invisibilityMode", "AWARE")));
772
775
 
776
+ // Set HTTP method and body if provided
777
+ String httpMethod = call.getString("method");
778
+ String httpBody = call.getString("body");
779
+ if (httpMethod != null) {
780
+ options.setHttpMethod(httpMethod);
781
+ }
782
+ if (httpBody != null) {
783
+ options.setHttpBody(httpBody);
784
+ }
785
+
773
786
  this.getActivity().runOnUiThread(
774
787
  new Runnable() {
775
788
  @Override
@@ -176,6 +176,7 @@ public class Options {
176
176
  private boolean preventDeeplink = false;
177
177
  private List<String> authorizedAppLinks = new ArrayList<>();
178
178
  private boolean enabledSafeBottomMargin = false;
179
+ private boolean enabledSafeTopMargin = true;
179
180
  private boolean useTopInset = false;
180
181
  private boolean enableGooglePaySupport = false;
181
182
  private List<String> blockedHosts = new ArrayList<>();
@@ -186,6 +187,8 @@ public class Options {
186
187
  private boolean hidden = false;
187
188
  private boolean allowWebViewJsVisibilityControl = false;
188
189
  private InvisibilityMode invisibilityMode = InvisibilityMode.AWARE;
190
+ private String httpMethod = null;
191
+ private String httpBody = null;
189
192
 
190
193
  public Integer getWidth() {
191
194
  return width;
@@ -243,6 +246,14 @@ public class Options {
243
246
  this.enabledSafeBottomMargin = enabledSafeBottomMargin;
244
247
  }
245
248
 
249
+ public boolean getEnabledSafeTopMargin() {
250
+ return enabledSafeTopMargin;
251
+ }
252
+
253
+ public void setEnabledSafeTopMargin(boolean enabledSafeTopMargin) {
254
+ this.enabledSafeTopMargin = enabledSafeTopMargin;
255
+ }
256
+
246
257
  public boolean getUseTopInset() {
247
258
  return useTopInset;
248
259
  }
@@ -527,4 +538,20 @@ public class Options {
527
538
  public void setInvisibilityMode(InvisibilityMode invisibilityMode) {
528
539
  this.invisibilityMode = invisibilityMode;
529
540
  }
541
+
542
+ public String getHttpMethod() {
543
+ return httpMethod;
544
+ }
545
+
546
+ public void setHttpMethod(String httpMethod) {
547
+ this.httpMethod = httpMethod;
548
+ }
549
+
550
+ public String getHttpBody() {
551
+ return httpBody;
552
+ }
553
+
554
+ public void setHttpBody(String httpBody) {
555
+ this.httpBody = httpBody;
556
+ }
530
557
  }
@@ -250,6 +250,19 @@ public class WebViewDialog extends Dialog {
250
250
  return _options != null && _options.getAllowWebViewJsVisibilityControl();
251
251
  }
252
252
 
253
+ /**
254
+ * Checks if the given HTTP method supports a request body.
255
+ * @param method The HTTP method to check
256
+ * @return true if the method supports a body (POST, PUT, PATCH), false otherwise
257
+ */
258
+ private boolean supportsRequestBody(String method) {
259
+ if (method == null) {
260
+ return false;
261
+ }
262
+ String upperMethod = method.toUpperCase();
263
+ return upperMethod.equals("POST") || upperMethod.equals("PUT") || upperMethod.equals("PATCH");
264
+ }
265
+
253
266
  public class PreShowScriptInterface {
254
267
 
255
268
  @JavascriptInterface
@@ -915,7 +928,30 @@ public class WebViewDialog extends Dialog {
915
928
  }
916
929
  }
917
930
 
918
- _webView.loadUrl(this._options.getUrl(), requestHeaders);
931
+ // Load URL with optional HTTP method and body
932
+ String httpMethod = _options.getHttpMethod();
933
+ String httpBody = _options.getHttpBody();
934
+
935
+ if (supportsRequestBody(httpMethod) && httpBody != null) {
936
+ // For POST/PUT/PATCH requests with body
937
+ // Note: Android WebView has limitations with custom headers on POST
938
+ // Headers may not be sent with the initial request when using postUrl
939
+ byte[] postData = httpBody.getBytes(StandardCharsets.UTF_8);
940
+ _webView.postUrl(this._options.getUrl(), postData);
941
+
942
+ // Log a warning if headers were provided, as they won't be sent with postUrl
943
+ if (!requestHeaders.isEmpty()) {
944
+ Log.w(
945
+ "InAppBrowser",
946
+ "Custom headers were provided but may not be sent with POST request. " +
947
+ "Android WebView's postUrl method has limited header support."
948
+ );
949
+ }
950
+ } else {
951
+ // For GET and other methods, use loadUrl with headers
952
+ _webView.loadUrl(this._options.getUrl(), requestHeaders);
953
+ }
954
+
919
955
  _webView.requestFocus();
920
956
  _webView.requestFocusFromTouch();
921
957
 
@@ -1181,8 +1217,10 @@ public class WebViewDialog extends Dialog {
1181
1217
  );
1182
1218
  int navBottom = _options.getEnabledSafeMargin() ? safeBottomInset : 0;
1183
1219
 
1184
- // Apply top inset only if useTopInset option is enabled or fallback to 0px
1185
- int navTop = _options.getUseTopInset() ? bars.top : 0;
1220
+ // Apply top inset based on enabledSafeTopMargin and useTopInset options
1221
+ // If enabledSafeTopMargin is false, force full screen (no top margin)
1222
+ // Otherwise, use useTopInset to determine if system inset should be applied
1223
+ int navTop = _options.getEnabledSafeTopMargin() && _options.getUseTopInset() ? bars.top : 0;
1186
1224
 
1187
1225
  // Avoid double-applying top inset; AppBar/status bar handled above on Android 15+
1188
1226
  mlp.topMargin = isAndroid15Plus ? 0 : navTop;
package/dist/docs.json CHANGED
@@ -751,6 +751,42 @@
751
751
  ],
752
752
  "type": "Credentials"
753
753
  },
754
+ {
755
+ "name": "method",
756
+ "tags": [
757
+ {
758
+ "text": "8.2.0",
759
+ "name": "since"
760
+ },
761
+ {
762
+ "text": "\"GET\"",
763
+ "name": "default"
764
+ },
765
+ {
766
+ "text": "method: \"POST\",\nbody: JSON.stringify({ token: \"auth-token\", data: \"value\" }),\nheaders: { \"Content-Type\": \"application/json\" }",
767
+ "name": "example"
768
+ }
769
+ ],
770
+ "docs": "HTTP method to use for the initial request.\n\n**Optional parameter - defaults to GET if not specified.**\nExisting code that doesn't provide this parameter will continue to work unchanged with standard GET requests.\n\nWhen specified with 'POST', 'PUT', or 'PATCH' methods that support a body,\nyou can also provide a `body` parameter with the request payload.\n\n**Platform Notes:**\n- iOS: Full support for all HTTP methods with headers\n- Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations",
771
+ "complexTypes": [],
772
+ "type": "string | undefined"
773
+ },
774
+ {
775
+ "name": "body",
776
+ "tags": [
777
+ {
778
+ "text": "8.2.0",
779
+ "name": "since"
780
+ },
781
+ {
782
+ "text": "method: \"POST\",\nbody: JSON.stringify({ username: \"user\", password: \"pass\" }),\nheaders: { \"Content-Type\": \"application/json\" }",
783
+ "name": "example"
784
+ }
785
+ ],
786
+ "docs": "HTTP body to send with the request when using POST, PUT, or other methods that support a body.\nShould be a string (use JSON.stringify for JSON data).\n\n**Optional parameter - only used when `method` is specified and supports a request body.**\nOmitting this parameter (or using GET method) results in standard behavior without a request body.",
787
+ "complexTypes": [],
788
+ "type": "string | undefined"
789
+ },
754
790
  {
755
791
  "name": "materialPicker",
756
792
  "tags": [
@@ -1297,6 +1333,26 @@
1297
1333
  "complexTypes": [],
1298
1334
  "type": "boolean | undefined"
1299
1335
  },
1336
+ {
1337
+ "name": "enabledSafeTopMargin",
1338
+ "tags": [
1339
+ {
1340
+ "text": "8.2.0",
1341
+ "name": "since"
1342
+ },
1343
+ {
1344
+ "text": "true",
1345
+ "name": "default"
1346
+ },
1347
+ {
1348
+ "text": "enabledSafeTopMargin: false // Full screen, extends behind status bar",
1349
+ "name": "example"
1350
+ }
1351
+ ],
1352
+ "docs": "If false, the webView will extend behind the status bar for true full-screen immersive content.\nWhen true (default), respects the safe area at the top of the screen.\nWorks independently of toolbarType - use for full-screen video players, games, or immersive web apps.",
1353
+ "complexTypes": [],
1354
+ "type": "boolean | undefined"
1355
+ },
1300
1356
  {
1301
1357
  "name": "useTopInset",
1302
1358
  "tags": [
@@ -181,6 +181,41 @@ export interface OpenWebViewOptions {
181
181
  * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/
182
182
  */
183
183
  credentials?: Credentials;
184
+ /**
185
+ * HTTP method to use for the initial request.
186
+ *
187
+ * **Optional parameter - defaults to GET if not specified.**
188
+ * Existing code that doesn't provide this parameter will continue to work unchanged with standard GET requests.
189
+ *
190
+ * When specified with 'POST', 'PUT', or 'PATCH' methods that support a body,
191
+ * you can also provide a `body` parameter with the request payload.
192
+ *
193
+ * **Platform Notes:**
194
+ * - iOS: Full support for all HTTP methods with headers
195
+ * - Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations
196
+ *
197
+ * @since 8.2.0
198
+ * @default "GET"
199
+ * @example
200
+ * method: "POST",
201
+ * body: JSON.stringify({ token: "auth-token", data: "value" }),
202
+ * headers: { "Content-Type": "application/json" }
203
+ */
204
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | string;
205
+ /**
206
+ * HTTP body to send with the request when using POST, PUT, or other methods that support a body.
207
+ * Should be a string (use JSON.stringify for JSON data).
208
+ *
209
+ * **Optional parameter - only used when `method` is specified and supports a request body.**
210
+ * Omitting this parameter (or using GET method) results in standard behavior without a request body.
211
+ *
212
+ * @since 8.2.0
213
+ * @example
214
+ * method: "POST",
215
+ * body: JSON.stringify({ username: "user", password: "pass" }),
216
+ * headers: { "Content-Type": "application/json" }
217
+ */
218
+ body?: string;
184
219
  /**
185
220
  * materialPicker: if true, uses Material Design theme for date and time pickers on Android.
186
221
  * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.
@@ -504,6 +539,16 @@ export interface OpenWebViewOptions {
504
539
  * enabledSafeBottomMargin: true
505
540
  */
506
541
  enabledSafeBottomMargin?: boolean;
542
+ /**
543
+ * If false, the webView will extend behind the status bar for true full-screen immersive content.
544
+ * When true (default), respects the safe area at the top of the screen.
545
+ * Works independently of toolbarType - use for full-screen video players, games, or immersive web apps.
546
+ * @since 8.2.0
547
+ * @default true
548
+ * @example
549
+ * enabledSafeTopMargin: false // Full screen, extends behind status bar
550
+ */
551
+ enabledSafeTopMargin?: boolean;
507
552
  /**
508
553
  * When true, applies the system status bar inset as the WebView top margin on Android.
509
554
  * Keeps the legacy 0px margin by default for apps that handle padding themselves.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UrlEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = 'white',\n BLACK = 'black',\n}\nexport enum ToolBarType {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ACTIVITY = 'activity',\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = 'compact',\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n NAVIGATION = 'navigation',\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n BLANK = 'blank',\n}\n\nexport enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n /**\n * Target webview id.\n * When omitted, applies to all open webviews.\n */\n id?: string;\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link\n * @since 0.1.0\n */\n preventDeeplink?: boolean;\n}\n\nexport interface OpenSecureWindowOptions {\n /**\n * The endpoint to open\n */\n authEndpoint: string;\n /**\n * The redirect URI to use for the openSecureWindow call.\n * This will be checked to make sure it matches the redirect URI after the window finishes the redirection.\n */\n redirectUri: string;\n /**\n * The name of the broadcast channel to listen to, relevant only for web\n */\n broadcastChannelName?: string;\n}\n\nexport interface OpenSecureWindowResponse {\n /**\n * The result of the openSecureWindow call\n */\n redirectedUri: string;\n}\n\nexport interface DisclaimerOptions {\n /**\n * Title of the disclaimer dialog\n * @default \"Title\"\n */\n title: string;\n /**\n * Message shown in the disclaimer dialog\n * @default \"Message\"\n */\n message: string;\n /**\n * Text for the confirm button\n * @default \"Confirm\"\n */\n confirmBtn: string;\n /**\n * Text for the cancel button\n * @default \"Cancel\"\n */\n cancelBtn: string;\n}\n\nexport interface CloseWebviewOptions {\n /**\n * Target webview id to close. If omitted, closes the active webview.\n */\n id?: string;\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n * @example \"https://capgo.app\"\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n * @example\n * headers: {\n * \"Custom-Header\": \"test-value\",\n * \"Authorization\": \"Bearer test-token\"\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n * @example\n * credentials: {\n * username: \"test-user\",\n * password: \"test-pass\"\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n credentials?: Credentials;\n /**\n * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\n /**\n * JavaScript Interface:\n * The webview automatically injects a JavaScript interface providing:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via \"messageFromWebview\" event)\n * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig\n *\n * @example\n * // In your webpage loaded in the webview:\n * document.getElementById(\"closeBtn\").addEventListener(\"click\", () => {\n * window.mobileApp.close();\n * });\n *\n * // Send data to the app\n * window.mobileApp.postMessage({ action: \"login\", data: { user: \"test\" }});\n *\n * @since 6.10.0\n */\n jsInterface?: never; // This property doesn't exist, it's just for documentation\n /**\n * Share options for the webview. When provided, shows a disclaimer dialog before sharing content.\n * This is useful for:\n * - Warning users about sharing sensitive information\n * - Getting user consent before sharing\n * - Explaining what will be shared\n * - Complying with privacy regulations\n *\n * Note: shareSubject is required when using shareDisclaimer\n * @since 0.1.0\n * @example\n * shareDisclaimer: {\n * title: \"Disclaimer\",\n * message: \"This is a test disclaimer\",\n * confirmBtn: \"Accept\",\n * cancelBtn: \"Decline\"\n * }\n * Test URL: https://capgo.app\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type determines the appearance and behavior of the browser's toolbar\n * - \"activity\": Shows a simple toolbar with just a close button and share button\n * - \"navigation\": Shows a full navigation toolbar with back/forward buttons\n * - \"blank\": Shows no toolbar\n * - \"\": Default toolbar with close button\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n * @example\n * toolbarType: ToolBarType.ACTIVITY,\n * title: \"Activity Toolbar Test\"\n * Test URL: https://capgo.app\n */\n toolbarType?: ToolBarType;\n /**\n * Subject text for sharing. Required when using shareDisclaimer.\n * This text will be used as the subject line when sharing content.\n * @since 0.1.0\n * @example \"Share this page\"\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default \"New Window\"\n * @example \"Camera Test\"\n */\n title?: string;\n /**\n * Background color of the browser\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: \"Close Window\",\n * closeModalDescription: \"Are you sure you want to close?\",\n * closeModalOk: \"Yes, close\",\n * closeModalCancel: \"No, stay\"\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default \"Close\"\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default \"Are you sure you want to close this window?\"\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default \"Close\"\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default \"Cancel\"\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default \"#ffffff\"\n * @example\n * toolbarColor: \"#FF5733\"\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: \"#FFFFFF\"\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: \"sf-symbol\",\n * icon: \"star.fill\"\n * },\n * android: {\n * iconType: \"asset\",\n * icon: \"public/monkey.svg\",\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: 'sf-symbol' | 'asset';\n icon: string;\n };\n android: {\n iconType: 'asset' | 'vector';\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * 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.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: boolean;\n\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(options?: { id?: string }): Promise<{ canGoBack: boolean }>;\n\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearAllCookies(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear cache\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearCache(options?: { id?: string }): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n * When `id` is omitted, closes the active webview.\n */\n close(options?: CloseWebviewOptions): Promise<any>;\n /**\n * Hide the webview without closing it.\n * Use show() to bring it back.\n *\n * @since 8.0.8\n */\n hide(): Promise<void>;\n /**\n * Show a previously hidden webview.\n *\n * @since 8.0.8\n */\n show(): Promise<void>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * JavaScript Interface:\n * When you open a webview with this method, a JavaScript interface is automatically injected that provides:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `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\n *\n * @returns Promise that resolves with the created webview id.\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<{ id: string }>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n * When `id` is omitted, executes in all open webviews.\n */\n executeScript(options: { code: string; id?: string }): Promise<void>;\n /**\n * 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)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n * When `id` is omitted, broadcasts to all open webviews.\n */\n postMessage(options: { detail: Record<string, any>; id?: string }): Promise<void>;\n /**\n * Sets the URL of the webview.\n * When `id` is omitted, targets the active webview.\n */\n setUrl(options: { url: string; id?: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): Promise<PluginListenerHandle>;\n /**\n * 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\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: 'messageFromWebview',\n listenerFunc: (event: { id?: string; detail?: Record<string, any>; rawMessage?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: 'pageLoadError',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(options?: { id?: string }): Promise<any>;\n\n /**\n * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions & { id?: string }): Promise<void>;\n\n /**\n * Opens a secured window for OAuth2 authentication.\n * For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app\n * Something like:\n * ```html\n * <html>\n * <head></head>\n * <body>\n * <script>\n * const searchParams = new URLSearchParams(location.search)\n * if (searchParams.has(\"code\")) {\n * new BroadcastChannel(\"my-channel-name\").postMessage(location.href);\n * window.close();\n * }\n * </script>\n * </body>\n * </html>\n * ```\n * For mobile, you should have a redirect uri that opens the app, something like: `myapp://oauth_callback/`\n * And make sure to register it in the app's info.plist:\n * ```xml\n * <key>CFBundleURLTypes</key>\n * <array>\n * <dict>\n * <key>CFBundleURLSchemes</key>\n * <array>\n * <string>myapp</string>\n * </array>\n * </dict>\n * </array>\n * ```\n * And in the AndroidManifest.xml file:\n * ```xml\n * <activity>\n * <intent-filter>\n * <action android:name=\"android.intent.action.VIEW\" />\n * <category android:name=\"android.intent.category.DEFAULT\" />\n * <category android:name=\"android.intent.category.BROWSABLE\" />\n * <data android:host=\"oauth_callback\" android:scheme=\"myapp\" />\n * </intent-filter>\n * </activity>\n * ```\n * @param options - the options for the openSecureWindow call\n */\n openSecureWindow(options: OpenSecureWindowOptions): Promise<OpenSecureWindowResponse>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: \"value\" });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement(\"button\");\n * closeButton.textContent = \"Close WebView\";\n * closeButton.addEventListener(\"click\", () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: \"dataSubmitted\",\n * data: { username: \"test\", email: \"test@example.com\" }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n\n /**\n * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n hide(): void;\n\n /**\n * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n show(): void;\n };\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UrlEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = 'white',\n BLACK = 'black',\n}\nexport enum ToolBarType {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ACTIVITY = 'activity',\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = 'compact',\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n NAVIGATION = 'navigation',\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n BLANK = 'blank',\n}\n\nexport enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n /**\n * Target webview id.\n * When omitted, applies to all open webviews.\n */\n id?: string;\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link\n * @since 0.1.0\n */\n preventDeeplink?: boolean;\n}\n\nexport interface OpenSecureWindowOptions {\n /**\n * The endpoint to open\n */\n authEndpoint: string;\n /**\n * The redirect URI to use for the openSecureWindow call.\n * This will be checked to make sure it matches the redirect URI after the window finishes the redirection.\n */\n redirectUri: string;\n /**\n * The name of the broadcast channel to listen to, relevant only for web\n */\n broadcastChannelName?: string;\n}\n\nexport interface OpenSecureWindowResponse {\n /**\n * The result of the openSecureWindow call\n */\n redirectedUri: string;\n}\n\nexport interface DisclaimerOptions {\n /**\n * Title of the disclaimer dialog\n * @default \"Title\"\n */\n title: string;\n /**\n * Message shown in the disclaimer dialog\n * @default \"Message\"\n */\n message: string;\n /**\n * Text for the confirm button\n * @default \"Confirm\"\n */\n confirmBtn: string;\n /**\n * Text for the cancel button\n * @default \"Cancel\"\n */\n cancelBtn: string;\n}\n\nexport interface CloseWebviewOptions {\n /**\n * Target webview id to close. If omitted, closes the active webview.\n */\n id?: string;\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n * @example \"https://capgo.app\"\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n * @example\n * headers: {\n * \"Custom-Header\": \"test-value\",\n * \"Authorization\": \"Bearer test-token\"\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n * @example\n * credentials: {\n * username: \"test-user\",\n * password: \"test-pass\"\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n credentials?: Credentials;\n /**\n * HTTP method to use for the initial request.\n *\n * **Optional parameter - defaults to GET if not specified.**\n * Existing code that doesn't provide this parameter will continue to work unchanged with standard GET requests.\n *\n * When specified with 'POST', 'PUT', or 'PATCH' methods that support a body,\n * you can also provide a `body` parameter with the request payload.\n *\n * **Platform Notes:**\n * - iOS: Full support for all HTTP methods with headers\n * - Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations\n *\n * @since 8.2.0\n * @default \"GET\"\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ token: \"auth-token\", data: \"value\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | string;\n /**\n * HTTP body to send with the request when using POST, PUT, or other methods that support a body.\n * Should be a string (use JSON.stringify for JSON data).\n *\n * **Optional parameter - only used when `method` is specified and supports a request body.**\n * Omitting this parameter (or using GET method) results in standard behavior without a request body.\n *\n * @since 8.2.0\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ username: \"user\", password: \"pass\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n body?: string;\n /**\n * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\n /**\n * JavaScript Interface:\n * The webview automatically injects a JavaScript interface providing:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via \"messageFromWebview\" event)\n * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig\n *\n * @example\n * // In your webpage loaded in the webview:\n * document.getElementById(\"closeBtn\").addEventListener(\"click\", () => {\n * window.mobileApp.close();\n * });\n *\n * // Send data to the app\n * window.mobileApp.postMessage({ action: \"login\", data: { user: \"test\" }});\n *\n * @since 6.10.0\n */\n jsInterface?: never; // This property doesn't exist, it's just for documentation\n /**\n * Share options for the webview. When provided, shows a disclaimer dialog before sharing content.\n * This is useful for:\n * - Warning users about sharing sensitive information\n * - Getting user consent before sharing\n * - Explaining what will be shared\n * - Complying with privacy regulations\n *\n * Note: shareSubject is required when using shareDisclaimer\n * @since 0.1.0\n * @example\n * shareDisclaimer: {\n * title: \"Disclaimer\",\n * message: \"This is a test disclaimer\",\n * confirmBtn: \"Accept\",\n * cancelBtn: \"Decline\"\n * }\n * Test URL: https://capgo.app\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type determines the appearance and behavior of the browser's toolbar\n * - \"activity\": Shows a simple toolbar with just a close button and share button\n * - \"navigation\": Shows a full navigation toolbar with back/forward buttons\n * - \"blank\": Shows no toolbar\n * - \"\": Default toolbar with close button\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n * @example\n * toolbarType: ToolBarType.ACTIVITY,\n * title: \"Activity Toolbar Test\"\n * Test URL: https://capgo.app\n */\n toolbarType?: ToolBarType;\n /**\n * Subject text for sharing. Required when using shareDisclaimer.\n * This text will be used as the subject line when sharing content.\n * @since 0.1.0\n * @example \"Share this page\"\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default \"New Window\"\n * @example \"Camera Test\"\n */\n title?: string;\n /**\n * Background color of the browser\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: \"Close Window\",\n * closeModalDescription: \"Are you sure you want to close?\",\n * closeModalOk: \"Yes, close\",\n * closeModalCancel: \"No, stay\"\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default \"Close\"\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default \"Are you sure you want to close this window?\"\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default \"Close\"\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default \"Cancel\"\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default \"#ffffff\"\n * @example\n * toolbarColor: \"#FF5733\"\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: \"#FFFFFF\"\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: \"sf-symbol\",\n * icon: \"star.fill\"\n * },\n * android: {\n * iconType: \"asset\",\n * icon: \"public/monkey.svg\",\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: 'sf-symbol' | 'asset';\n icon: string;\n };\n android: {\n iconType: 'asset' | 'vector';\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * 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.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * If false, the webView will extend behind the status bar for true full-screen immersive content.\n * When true (default), respects the safe area at the top of the screen.\n * Works independently of toolbarType - use for full-screen video players, games, or immersive web apps.\n * @since 8.2.0\n * @default true\n * @example\n * enabledSafeTopMargin: false // Full screen, extends behind status bar\n */\n enabledSafeTopMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: boolean;\n\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(options?: { id?: string }): Promise<{ canGoBack: boolean }>;\n\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearAllCookies(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear cache\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearCache(options?: { id?: string }): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n * When `id` is omitted, closes the active webview.\n */\n close(options?: CloseWebviewOptions): Promise<any>;\n /**\n * Hide the webview without closing it.\n * Use show() to bring it back.\n *\n * @since 8.0.8\n */\n hide(): Promise<void>;\n /**\n * Show a previously hidden webview.\n *\n * @since 8.0.8\n */\n show(): Promise<void>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * JavaScript Interface:\n * When you open a webview with this method, a JavaScript interface is automatically injected that provides:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `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\n *\n * @returns Promise that resolves with the created webview id.\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<{ id: string }>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n * When `id` is omitted, executes in all open webviews.\n */\n executeScript(options: { code: string; id?: string }): Promise<void>;\n /**\n * 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)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n * When `id` is omitted, broadcasts to all open webviews.\n */\n postMessage(options: { detail: Record<string, any>; id?: string }): Promise<void>;\n /**\n * Sets the URL of the webview.\n * When `id` is omitted, targets the active webview.\n */\n setUrl(options: { url: string; id?: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): Promise<PluginListenerHandle>;\n /**\n * 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\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: 'messageFromWebview',\n listenerFunc: (event: { id?: string; detail?: Record<string, any>; rawMessage?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: 'pageLoadError',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(options?: { id?: string }): Promise<any>;\n\n /**\n * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions & { id?: string }): Promise<void>;\n\n /**\n * Opens a secured window for OAuth2 authentication.\n * For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app\n * Something like:\n * ```html\n * <html>\n * <head></head>\n * <body>\n * <script>\n * const searchParams = new URLSearchParams(location.search)\n * if (searchParams.has(\"code\")) {\n * new BroadcastChannel(\"my-channel-name\").postMessage(location.href);\n * window.close();\n * }\n * </script>\n * </body>\n * </html>\n * ```\n * For mobile, you should have a redirect uri that opens the app, something like: `myapp://oauth_callback/`\n * And make sure to register it in the app's info.plist:\n * ```xml\n * <key>CFBundleURLTypes</key>\n * <array>\n * <dict>\n * <key>CFBundleURLSchemes</key>\n * <array>\n * <string>myapp</string>\n * </array>\n * </dict>\n * </array>\n * ```\n * And in the AndroidManifest.xml file:\n * ```xml\n * <activity>\n * <intent-filter>\n * <action android:name=\"android.intent.action.VIEW\" />\n * <category android:name=\"android.intent.category.DEFAULT\" />\n * <category android:name=\"android.intent.category.BROWSABLE\" />\n * <data android:host=\"oauth_callback\" android:scheme=\"myapp\" />\n * </intent-filter>\n * </activity>\n * ```\n * @param options - the options for the openSecureWindow call\n */\n openSecureWindow(options: OpenSecureWindowOptions): Promise<OpenSecureWindowResponse>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: \"value\" });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement(\"button\");\n * closeButton.textContent = \"Close WebView\";\n * closeButton.addEventListener(\"click\", () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: \"dataSubmitted\",\n * data: { username: \"test\", email: \"test@example.com\" }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n\n /**\n * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n hide(): void;\n\n /**\n * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n show(): void;\n };\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
@@ -29,7 +29,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
29
29
  case aware = "AWARE"
30
30
  case fakeVisible = "FAKE_VISIBLE"
31
31
  }
32
- private let pluginVersion: String = "8.1.19"
32
+ private let pluginVersion: String = "8.1.21"
33
33
  public let identifier = "InAppBrowserPlugin"
34
34
  public let jsName = "InAppBrowser"
35
35
  public let pluginMethods: [CAPPluginMethod] = [
@@ -198,8 +198,12 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
198
198
  ? webViewController.view.safeAreaLayoutGuide.bottomAnchor
199
199
  : webViewController.view.bottomAnchor
200
200
 
201
+ let topAnchor = webViewController.enabledSafeTopMargin
202
+ ? webViewController.view.safeAreaLayoutGuide.topAnchor
203
+ : webViewController.view.topAnchor
204
+
201
205
  NSLayoutConstraint.activate([
202
- webView.topAnchor.constraint(equalTo: webViewController.view.safeAreaLayoutGuide.topAnchor),
206
+ webView.topAnchor.constraint(equalTo: topAnchor),
203
207
  webView.leadingAnchor.constraint(equalTo: webViewController.view.leadingAnchor),
204
208
  webView.trailingAnchor.constraint(equalTo: webViewController.view.trailingAnchor),
205
209
  webView.bottomAnchor.constraint(equalTo: bottomAnchor)
@@ -497,6 +501,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
497
501
  let preventDeeplink = call.getBool("preventDeeplink", false)
498
502
  let isAnimated = call.getBool("isAnimated", true)
499
503
  let enabledSafeBottomMargin = call.getBool("enabledSafeBottomMargin", false)
504
+ let enabledSafeTopMargin = call.getBool("enabledSafeTopMargin", true)
500
505
  let hidden = call.getBool("hidden", false)
501
506
  self.isHidden = hidden
502
507
  let allowWebViewJsVisibilityControl = self.getConfig().getBoolean("allowWebViewJsVisibilityControl", false)
@@ -575,6 +580,10 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
575
580
 
576
581
  let credentials = self.readCredentials(call)
577
582
 
583
+ // Read HTTP method and body for custom requests
584
+ let httpMethod = call.getString("method")
585
+ let httpBody = call.getString("body")
586
+
578
587
  // Read dimension options
579
588
  let width = call.getFloat("width")
580
589
  let height = call.getFloat("height")
@@ -604,6 +613,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
604
613
  preventDeeplink: preventDeeplink,
605
614
  blankNavigationTab: toolbarType == "blank",
606
615
  enabledSafeBottomMargin: enabledSafeBottomMargin,
616
+ enabledSafeTopMargin: enabledSafeTopMargin,
607
617
  blockedHosts: blockedHosts,
608
618
  authorizedAppLinks: authorizedAppLinks,
609
619
  )
@@ -617,6 +627,14 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
617
627
  webViewController.instanceId = webViewId
618
628
  webViewController.allowWebViewJsVisibilityControl = allowWebViewJsVisibilityControl
619
629
 
630
+ // Set HTTP method and body if provided
631
+ if let method = httpMethod {
632
+ webViewController.httpMethod = method
633
+ }
634
+ if let body = httpBody {
635
+ webViewController.httpBody = body
636
+ }
637
+
620
638
  // Set dimensions if provided
621
639
  if let width = width {
622
640
  webViewController.customWidth = CGFloat(width)
@@ -1157,7 +1175,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1157
1175
  return
1158
1176
  }
1159
1177
 
1160
- self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: true, enabledSafeBottomMargin: false)
1178
+ self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: true, enabledSafeBottomMargin: false, enabledSafeTopMargin: true)
1161
1179
 
1162
1180
  guard let webViewController = self.webViewController else {
1163
1181
  call.reject("Failed to initialize WebViewController")
@@ -76,10 +76,11 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
76
76
  self.initWebview(isInspectable: isInspectable)
77
77
  }
78
78
 
79
- public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool) {
79
+ public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, enabledSafeTopMargin: Bool = true) {
80
80
  super.init(nibName: nil, bundle: nil)
81
81
  self.blankNavigationTab = blankNavigationTab
82
82
  self.enabledSafeBottomMargin = enabledSafeBottomMargin
83
+ self.enabledSafeTopMargin = enabledSafeTopMargin
83
84
  self.source = .remote(url)
84
85
  self.credentials = credentials
85
86
  self.setHeaders(headers: headers)
@@ -87,10 +88,11 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
87
88
  self.initWebview(isInspectable: isInspectable)
88
89
  }
89
90
 
90
- public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, blockedHosts: [String]) {
91
+ public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, enabledSafeTopMargin: Bool = true, blockedHosts: [String]) {
91
92
  super.init(nibName: nil, bundle: nil)
92
93
  self.blankNavigationTab = blankNavigationTab
93
94
  self.enabledSafeBottomMargin = enabledSafeBottomMargin
95
+ self.enabledSafeTopMargin = enabledSafeTopMargin
94
96
  self.source = .remote(url)
95
97
  self.credentials = credentials
96
98
  self.setHeaders(headers: headers)
@@ -99,10 +101,11 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
99
101
  self.initWebview(isInspectable: isInspectable)
100
102
  }
101
103
 
102
- public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, blockedHosts: [String], authorizedAppLinks: [String]) {
104
+ public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, enabledSafeTopMargin: Bool = true, blockedHosts: [String], authorizedAppLinks: [String]) {
103
105
  super.init(nibName: nil, bundle: nil)
104
106
  self.blankNavigationTab = blankNavigationTab
105
107
  self.enabledSafeBottomMargin = enabledSafeBottomMargin
108
+ self.enabledSafeTopMargin = enabledSafeTopMargin
106
109
  self.source = .remote(url)
107
110
  self.credentials = credentials
108
111
  self.setHeaders(headers: headers)
@@ -123,6 +126,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
123
126
  open var bypassedSSLHosts: [String]?
124
127
  open var cookies: [HTTPCookie]?
125
128
  open var headers: [String: String]?
129
+ open var httpMethod: String?
130
+ open var httpBody: String?
126
131
  open var capBrowserPlugin: InAppBrowserPlugin?
127
132
  var instanceId: String = ""
128
133
  var shareDisclaimer: [String: Any]?
@@ -143,6 +148,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
143
148
  var blankNavigationTab: Bool = false
144
149
  var capacitorStatusBar: UIView?
145
150
  var enabledSafeBottomMargin: Bool = false
151
+ var enabledSafeTopMargin: Bool = true
146
152
  var blockedHosts: [String] = []
147
153
  var authorizedAppLinks: [String] = []
148
154
  var activeNativeNavigationForWebview: Bool = true
@@ -731,17 +737,22 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
731
737
 
732
738
  // Then set up constraints
733
739
  webView.translatesAutoresizingMaskIntoConstraints = false
734
- var bottomPadding = self.view.bottomAnchor
740
+ var bottomAnchor = self.view.bottomAnchor
741
+ var topAnchor = self.view.safeAreaLayoutGuide.topAnchor
735
742
 
736
743
  if self.enabledSafeBottomMargin {
737
- bottomPadding = self.view.safeAreaLayoutGuide.bottomAnchor
744
+ bottomAnchor = self.view.safeAreaLayoutGuide.bottomAnchor
745
+ }
746
+
747
+ if !self.enabledSafeTopMargin {
748
+ topAnchor = self.view.topAnchor
738
749
  }
739
750
 
740
751
  NSLayoutConstraint.activate([
741
- webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor),
752
+ webView.topAnchor.constraint(equalTo: topAnchor),
742
753
  webView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
743
754
  webView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
744
- webView.bottomAnchor.constraint(equalTo: bottomPadding)
755
+ webView.bottomAnchor.constraint(equalTo: bottomAnchor)
745
756
  ])
746
757
 
747
758
  webView.uiDelegate = self
@@ -1079,6 +1090,16 @@ fileprivate extension WKWebViewController {
1079
1090
  func createRequest(url: URL) -> URLRequest {
1080
1091
  var request = URLRequest(url: url)
1081
1092
 
1093
+ // Set up HTTP method if specified
1094
+ if let method = httpMethod {
1095
+ request.httpMethod = method.uppercased()
1096
+ }
1097
+
1098
+ // Set up HTTP body if specified
1099
+ if let body = httpBody, let data = body.data(using: .utf8) {
1100
+ request.httpBody = data
1101
+ }
1102
+
1082
1103
  // Set up headers
1083
1104
  if let headers = headers {
1084
1105
  for (field, value) in headers {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "8.1.19",
3
+ "version": "8.1.21",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",