@calvingoh-hexa/capacitor-inappbrowser 6.9.37 → 7.29.4

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.
Files changed (49) hide show
  1. package/{CapgoInappbrowser.podspec → CalvingohHexaCapacitorInappbrowser.podspec} +2 -2
  2. package/LICENSE +373 -21
  3. package/Package.swift +28 -0
  4. package/README.md +269 -137
  5. package/android/build.gradle +12 -12
  6. package/android/src/main/AndroidManifest.xml +12 -2
  7. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +904 -655
  8. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +444 -298
  9. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +8 -6
  10. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +2916 -1031
  11. package/android/src/main/res/drawable/ic_share.xml +10 -0
  12. package/android/src/main/res/layout/activity_browser.xml +10 -0
  13. package/android/src/main/res/layout/content_browser.xml +3 -2
  14. package/android/src/main/res/layout/tool_bar.xml +30 -15
  15. package/android/src/main/res/values/strings.xml +2 -0
  16. package/android/src/main/res/values/themes.xml +27 -0
  17. package/android/src/main/res/xml/file_paths.xml +14 -0
  18. package/dist/docs.json +485 -643
  19. package/dist/esm/definitions.d.ts +447 -67
  20. package/dist/esm/definitions.js +17 -1
  21. package/dist/esm/definitions.js.map +1 -1
  22. package/dist/esm/index.d.ts +2 -2
  23. package/dist/esm/index.js +4 -4
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/web.d.ts +7 -2
  26. package/dist/esm/web.js +23 -11
  27. package/dist/esm/web.js.map +1 -1
  28. package/dist/plugin.cjs.js +40 -12
  29. package/dist/plugin.cjs.js.map +1 -1
  30. package/dist/plugin.js +40 -12
  31. package/dist/plugin.js.map +1 -1
  32. package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +952 -0
  33. package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +2006 -0
  34. package/package.json +27 -25
  35. package/ios/Plugin/Assets.xcassets/Back.imageset/Back.png +0 -0
  36. package/ios/Plugin/Assets.xcassets/Back.imageset/Back@2x.png +0 -0
  37. package/ios/Plugin/Assets.xcassets/Back.imageset/Back@3x.png +0 -0
  38. package/ios/Plugin/Assets.xcassets/Back.imageset/Contents.json +0 -26
  39. package/ios/Plugin/Assets.xcassets/Contents.json +0 -6
  40. package/ios/Plugin/Assets.xcassets/Forward.imageset/Contents.json +0 -26
  41. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward.png +0 -0
  42. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@2x.png +0 -0
  43. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@3x.png +0 -0
  44. package/ios/Plugin/InAppBrowserPlugin.h +0 -10
  45. package/ios/Plugin/InAppBrowserPlugin.m +0 -21
  46. package/ios/Plugin/InAppBrowserPlugin.swift +0 -434
  47. package/ios/Plugin/Info.plist +0 -24
  48. package/ios/Plugin/WKWebViewController.swift +0 -1021
  49. /package/ios/{Plugin → Sources/InAppBrowserPlugin}/Enums.swift +0 -0
package/README.md CHANGED
@@ -2,11 +2,29 @@
2
2
  <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
3
3
 
4
4
  <div align="center">
5
- <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo 🚀</a></h2>
6
- <h2><a href="https://capgo.app/consulting/?ref=plugin"> Fix your annoying bug now, Hire a Capacitor expert 💪</a></h2>
5
+ <h2><a href="https://capgo.app/?ref=plugin_inappbrowser"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
+ <h2><a href="https://capgo.app/consulting/?ref=plugin_inappbrowser"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
7
7
  </div>
8
8
 
9
- Capacitor plugin in app browser with urlChangeEvent
9
+ Capacitor plugin in app browser with urlChangeEvent, two way communication, camera and microphone usage, etc.
10
+
11
+ ## Why InAppBrowser?
12
+
13
+ The official Capacitor Browser plugin has strict security limitations that prevent advanced features. InAppBrowser removes these restrictions, enabling:
14
+
15
+ - **Two-way communication** between your app and the browser
16
+ - **JavaScript injection** for dynamic content manipulation
17
+ - **Camera and microphone access** within the browser context
18
+ - **URL change monitoring** for navigation tracking
19
+ - **Custom toolbars and UI** for branded experiences
20
+ - **Cookie and cache management** for session control
21
+ - **Custom sizes** for extra control of the display position
22
+
23
+ Perfect for OAuth flows, embedded web apps, video calls, and any scenario requiring deep integration with web content.
24
+
25
+ ## Documentation
26
+
27
+ The most complete doc is available here: https://capgo.app/docs/plugins/inappbrowser/
10
28
 
11
29
  ## Install
12
30
 
@@ -22,8 +40,53 @@ import { InAppBrowser } from '@capgo/inappbrowser'
22
40
  InAppBrowser.open({ url: "YOUR_URL" });
23
41
  ```
24
42
 
43
+ ### Open WebView with Custom Dimensions
44
+
45
+ By default, the webview opens in fullscreen. You can set custom dimensions to control the size and position:
46
+
47
+ ```js
48
+ import { InAppBrowser } from '@capgo/inappbrowser'
49
+
50
+ // Open with custom dimensions (400x600 at position 50,100)
51
+ InAppBrowser.openWebView({
52
+ url: "YOUR_URL",
53
+ width: 400,
54
+ height: 600,
55
+ x: 50,
56
+ y: 100
57
+ });
58
+
59
+ // Update dimensions at runtime
60
+ InAppBrowser.updateDimensions({
61
+ width: 500,
62
+ height: 700,
63
+ x: 100,
64
+ y: 150
65
+ });
66
+ ```
67
+
68
+ **Touch Passthrough**: When custom dimensions are set (not fullscreen), touches outside the webview bounds will pass through to the underlying Capacitor webview, allowing the user to interact with your app in the exposed areas. This enables picture-in-picture style experiences where the InAppBrowser floats above your content.
69
+
70
+ ### Open WebView with Safe Margin
71
+
72
+ To create a webView with a 20px bottom margin (safe margin area outside the browser):
73
+
74
+ ```js
75
+ import { InAppBrowser } from '@capgo/inappbrowser'
76
+
77
+ InAppBrowser.openWebView({
78
+ url: "YOUR_URL",
79
+ enabledSafeBottomMargin: true
80
+ });
81
+ ```
82
+
25
83
  Web platform is not supported. Use `window.open` instead.
26
84
 
85
+
86
+ ### Test app and code:
87
+
88
+ https://github.com/Cap-go/demo-app/blob/main/src/views/plugins/Web.vue
89
+
27
90
  ### Camera usage
28
91
 
29
92
  #### Android
@@ -69,16 +132,79 @@ Add the following to your `Info.plist` file:
69
132
  <string>We need access to the microphone to record audio.</string>
70
133
  ```
71
134
 
135
+ ### Location usage
136
+
137
+ #### Android
138
+
139
+ Add the following to your `AndroidManifest.xml` file:
140
+
141
+ ```xml
142
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
143
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
144
+ ```
145
+
146
+ Then the permission will be asked when location is requested by a website in the webview.
147
+
148
+ #### iOS
149
+
150
+ Add the following to your `Info.plist` file:
151
+
152
+ ```xml
153
+ <key>NSLocationWhenInUseUsageDescription</key>
154
+ <string>We need access to your location to provide location-based services.</string>
155
+ ```
156
+
157
+ ### Two way communication
158
+
159
+ With this plugin you can send events from the main app to the inappbrowser and vice versa.
160
+
161
+ > The data is sent as a JSON object, so no functions or other non-JSON-serializable types are allowed.
162
+
163
+ #### Main app to inappbrowser, detail object is mendatory
164
+
165
+ ```js
166
+ InAppBrowser.postMessage({ detail: { message: "myMessage" } });
167
+ ```
168
+
169
+ #### Receive event from native in the inappbrowser
170
+
171
+ ```js
172
+ window.addEventListener("messageFromNative", (event) => {
173
+ console.log(event);
174
+ });
175
+ ```
176
+
177
+ #### Send event from inappbrowser to main app, detail object is mendatory
178
+
179
+ ```js
180
+ window.mobileApp.postMessage({ detail: { message: "myMessage" } });
181
+ ```
182
+
183
+ #### Receive event from inappbrowser in the main app
184
+
185
+ ```js
186
+ InAppBrowser.addEventListener("messageFromWebview", (event) => {
187
+ console.log(event);
188
+ });
189
+ ```
190
+
191
+ ### Close inappbrowser from inappbrowser itself
192
+
193
+ ```js
194
+ window.mobileApp.close();
195
+ ```
196
+
72
197
  ## API
73
198
 
74
199
  <docgen-index>
75
200
 
201
+ * [`goBack()`](#goback)
76
202
  * [`open(...)`](#open)
77
203
  * [`clearCookies(...)`](#clearcookies)
78
204
  * [`clearAllCookies()`](#clearallcookies)
79
205
  * [`clearCache()`](#clearcache)
80
206
  * [`getCookies(...)`](#getcookies)
81
- * [`close()`](#close)
207
+ * [`close(...)`](#close)
82
208
  * [`openWebView(...)`](#openwebview)
83
209
  * [`executeScript(...)`](#executescript)
84
210
  * [`postMessage(...)`](#postmessage)
@@ -92,6 +218,7 @@ Add the following to your `Info.plist` file:
92
218
  * [`addListener('pageLoadError', ...)`](#addlistenerpageloaderror-)
93
219
  * [`removeAllListeners()`](#removealllisteners)
94
220
  * [`reload()`](#reload)
221
+ * [`updateDimensions(...)`](#updatedimensions)
95
222
  * [Interfaces](#interfaces)
96
223
  * [Type Aliases](#type-aliases)
97
224
  * [Enums](#enums)
@@ -101,13 +228,28 @@ Add the following to your `Info.plist` file:
101
228
  <docgen-api>
102
229
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
103
230
 
231
+ ### goBack()
232
+
233
+ ```typescript
234
+ goBack() => Promise<{ canGoBack: boolean; }>
235
+ ```
236
+
237
+ Navigates back in the WebView's history if possible
238
+
239
+ **Returns:** <code>Promise&lt;{ canGoBack: boolean; }&gt;</code>
240
+
241
+ **Since:** 7.21.0
242
+
243
+ --------------------
244
+
245
+
104
246
  ### open(...)
105
247
 
106
248
  ```typescript
107
249
  open(options: OpenOptions) => Promise<any>
108
250
  ```
109
251
 
110
- Open url in a new window fullscreen
252
+ Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController
111
253
 
112
254
  | Param | Type |
113
255
  | ------------- | --------------------------------------------------- |
@@ -186,14 +328,18 @@ Get cookies for a specific URL.
186
328
  --------------------
187
329
 
188
330
 
189
- ### close()
331
+ ### close(...)
190
332
 
191
333
  ```typescript
192
- close() => Promise<any>
334
+ close(options?: CloseWebviewOptions | undefined) => Promise<any>
193
335
  ```
194
336
 
195
337
  Close the webview.
196
338
 
339
+ | Param | Type |
340
+ | ------------- | ------------------------------------------------------------------- |
341
+ | **`options`** | <code><a href="#closewebviewoptions">CloseWebviewOptions</a></code> |
342
+
197
343
  **Returns:** <code>Promise&lt;any&gt;</code>
198
344
 
199
345
  --------------------
@@ -207,6 +353,11 @@ openWebView(options: OpenWebViewOptions) => Promise<any>
207
353
 
208
354
  Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.
209
355
 
356
+ JavaScript Interface:
357
+ When you open a webview with this method, a JavaScript interface is automatically injected that provides:
358
+ - `window.mobileApp.close()`: Closes the webview from JavaScript
359
+ - `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
360
+
210
361
  | Param | Type |
211
362
  | ------------- | ----------------------------------------------------------------- |
212
363
  | **`options`** | <code><a href="#openwebviewoptions">OpenWebViewOptions</a></code> |
@@ -239,7 +390,7 @@ Injects JavaScript code into the InAppBrowser window.
239
390
  postMessage(options: { detail: Record<string, any>; }) => Promise<void>
240
391
  ```
241
392
 
242
- Sends an event to the webview. you can listen to this event with addListener("messageFromWebview", listenerFunc: (event: <a href="#record">Record</a>&lt;string, any&gt;) =&gt; void)
393
+ Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addEventListener("messageFromNative", listenerFunc: (event: <a href="#record">Record</a>&lt;string, any&gt;) =&gt; void)
243
394
  detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects
244
395
  Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.
245
396
 
@@ -270,7 +421,7 @@ Sets the URL of the webview.
270
421
  ### addListener('urlChangeEvent', ...)
271
422
 
272
423
  ```typescript
273
- addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
424
+ addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
274
425
  ```
275
426
 
276
427
  Listen for url change, only for openWebView
@@ -290,7 +441,7 @@ Listen for url change, only for openWebView
290
441
  ### addListener('buttonNearDoneClick', ...)
291
442
 
292
443
  ```typescript
293
- addListener(eventName: "buttonNearDoneClick", listenerFunc: ButtonNearListener) => Promise<PluginListenerHandle>
444
+ addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener) => Promise<PluginListenerHandle>
294
445
  ```
295
446
 
296
447
  | Param | Type |
@@ -306,7 +457,7 @@ addListener(eventName: "buttonNearDoneClick", listenerFunc: ButtonNearListener)
306
457
  ### addListener('closeEvent', ...)
307
458
 
308
459
  ```typescript
309
- addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
460
+ addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
310
461
  ```
311
462
 
312
463
  Listen for close click only for openWebView
@@ -326,10 +477,11 @@ Listen for close click only for openWebView
326
477
  ### addListener('confirmBtnClicked', ...)
327
478
 
328
479
  ```typescript
329
- addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle>
480
+ addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle>
330
481
  ```
331
482
 
332
- Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
483
+ Will be triggered when user clicks on confirm button when disclaimer is required,
484
+ works with openWebView shareDisclaimer and closeModal
333
485
 
334
486
  | Param | Type |
335
487
  | ------------------ | ----------------------------------------------------------------- |
@@ -346,12 +498,12 @@ Will be triggered when user clicks on confirm button when disclaimer is required
346
498
  ### addListener('messageFromWebview', ...)
347
499
 
348
500
  ```typescript
349
- addListener(eventName: "messageFromWebview", listenerFunc: (event: { detail: Record<string, any>; }) => void) => Promise<PluginListenerHandle>
501
+ addListener(eventName: 'messageFromWebview', listenerFunc: (event: { detail: Record<string, any>; }) => void) => Promise<PluginListenerHandle>
350
502
  ```
351
503
 
352
- Will be triggered when event is sent from webview, to send an event to the webview use window.mobileApp.postMessage({ "detail": { "message": "myMessage" } })
353
- detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects
354
- Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.
504
+ 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" } })
505
+ detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects
506
+ Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.
355
507
 
356
508
  This method is inject at runtime in the webview
357
509
 
@@ -368,7 +520,7 @@ This method is inject at runtime in the webview
368
520
  ### addListener('browserPageLoaded', ...)
369
521
 
370
522
  ```typescript
371
- addListener(eventName: "browserPageLoaded", listenerFunc: () => void) => Promise<PluginListenerHandle>
523
+ addListener(eventName: 'browserPageLoaded', listenerFunc: () => void) => Promise<PluginListenerHandle>
372
524
  ```
373
525
 
374
526
  Will be triggered when page is loaded
@@ -386,7 +538,7 @@ Will be triggered when page is loaded
386
538
  ### addListener('pageLoadError', ...)
387
539
 
388
540
  ```typescript
389
- addListener(eventName: "pageLoadError", listenerFunc: () => void) => Promise<PluginListenerHandle>
541
+ addListener(eventName: 'pageLoadError', listenerFunc: () => void) => Promise<PluginListenerHandle>
390
542
  ```
391
543
 
392
544
  Will be triggered when page load error
@@ -429,29 +581,32 @@ Reload the current web page.
429
581
  --------------------
430
582
 
431
583
 
432
- ### Interfaces
584
+ ### updateDimensions(...)
433
585
 
586
+ ```typescript
587
+ updateDimensions(options: DimensionOptions) => Promise<void>
588
+ ```
434
589
 
435
- #### OpenOptions
590
+ Update the dimensions of the webview.
591
+ Allows changing the size and position of the webview at runtime.
436
592
 
437
- | Prop | Type | Description | Since |
438
- | ---------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----- |
439
- | **`url`** | <code>string</code> | Target URL to load. | 0.1.0 |
440
- | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | 0.1.0 |
441
- | **`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 |
442
- | **`isPresentAfterPageLoad`** | <code>boolean</code> | if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | 0.1.0 |
443
- | **`preventDeeplink`** | <code>boolean</code> | | |
593
+ | Param | Type | Description |
594
+ | ------------- | ------------------------------------------------------------- | --------------------------------------- |
595
+ | **`options`** | <code><a href="#dimensionoptions">DimensionOptions</a></code> | Dimension options (width, height, x, y) |
444
596
 
597
+ --------------------
445
598
 
446
- #### Headers
447
599
 
600
+ ### Interfaces
448
601
 
449
- #### Credentials
450
602
 
451
- | Prop | Type |
452
- | -------------- | ------------------- |
453
- | **`username`** | <code>string</code> |
454
- | **`password`** | <code>string</code> |
603
+ #### OpenOptions
604
+
605
+ | Prop | Type | Description | Since |
606
+ | ---------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------- | ----- |
607
+ | **`url`** | <code>string</code> | Target URL to load. | 0.1.0 |
608
+ | **`isPresentAfterPageLoad`** | <code>boolean</code> | if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | 0.1.0 |
609
+ | **`preventDeeplink`** | <code>boolean</code> | if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link | 0.1.0 |
455
610
 
456
611
 
457
612
  #### ClearCookieOptions
@@ -478,112 +633,79 @@ Reload the current web page.
478
633
  | **`includeHttpOnly`** | <code>boolean</code> |
479
634
 
480
635
 
481
- #### OpenWebViewOptions
482
-
483
- | Prop | Type | Description | Default | Since |
484
- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------ |
485
- | **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
486
- | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
487
- | **`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 |
488
- | **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | share options | | 0.1.0 |
489
- | **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
490
- | **`shareSubject`** | <code>string</code> | Share subject | | 0.1.0 |
491
- | **`title`** | <code>string</code> | Title of the browser | <code>'New Window'</code> | 0.1.0 |
492
- | **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> | Background color of the browser, only on IOS | <code>BackgroundColor.BLACK</code> | 0.1.0 |
493
- | **`activeNativeNavigationForWebview`** | <code>boolean</code> | If true, active the native navigation within the webview, Android only | <code>false</code> | |
494
- | **`disableGoBackOnNativeApplication`** | <code>boolean</code> | Disable the possibility to go back on native application, usefull to force user to stay on the webview, Android only | <code>false</code> | |
495
- | **`isPresentAfterPageLoad`** | <code>boolean</code> | 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. | <code>false</code> | 0.1.0 |
496
- | **`isInspectable`** | <code>boolean</code> | Whether the website in the webview is inspectable or not, ios only | <code>false</code> | |
497
- | **`isAnimated`** | <code>boolean</code> | Whether the webview opening is animated or not, ios only | <code>true</code> | |
498
- | **`showReloadButton`** | <code>boolean</code> | Shows a reload button that reloads the web page | <code>false</code> | 1.0.15 |
499
- | **`closeModal`** | <code>boolean</code> | CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately. | <code>false</code> | 1.1.0 |
500
- | **`closeModalTitle`** | <code>string</code> | CloseModalTitle: title of the confirm when user clicks on close button, only on IOS | <code>'Close'</code> | 1.1.0 |
501
- | **`closeModalDescription`** | <code>string</code> | CloseModalDescription: description of the confirm when user clicks on close button, only on IOS | <code>'Are you sure you want to close this window?'</code> | 1.1.0 |
502
- | **`closeModalOk`** | <code>string</code> | CloseModalOk: text of the confirm button when user clicks on close button, only on IOS | <code>'Close'</code> | 1.1.0 |
503
- | **`closeModalCancel`** | <code>string</code> | CloseModalCancel: text of the cancel button when user clicks on close button, only on IOS | <code>'Cancel'</code> | 1.1.0 |
504
- | **`visibleTitle`** | <code>boolean</code> | visibleTitle: if true the website title would be shown else shown empty | <code>true</code> | 1.2.5 |
505
- | **`toolbarColor`** | <code>string</code> | toolbarColor: color of the toolbar in hex format | <code>'#ffffff''</code> | 1.2.5 |
506
- | **`showArrow`** | <code>boolean</code> | showArrow: if true an arrow would be shown instead of cross for closing the window | <code>false</code> | 1.2.5 |
507
- | **`ignoreUntrustedSSLError`** | <code>boolean</code> | ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website. | <code>false</code> | 6.1.0 |
508
- | **`preShowScript`** | <code><a href="#string">String</a></code> | 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) | | 6.6.0 |
509
- | **`proxyRequests`** | <code><a href="#string">String</a></code> | proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only) | | 6.9.0 |
510
- | **`buttonNearDone`** | <code>{ ios: { iconType: 'sf-symbol' \| 'asset'; icon: <a href="#string">String</a>; }; android: { iconType: 'asset'; icon: <a href="#string">String</a>; width?: number; height?: number; }; }</code> | buttonNearDone allows for a creation of a custom button. Please see [buttonNearDone.md](/buttonNearDone.md) for more info. | | 6.7.0 |
511
-
512
-
513
- #### DisclaimerOptions
514
-
515
- | Prop | Type |
516
- | ---------------- | ------------------- |
517
- | **`title`** | <code>string</code> |
518
- | **`message`** | <code>string</code> |
519
- | **`confirmBtn`** | <code>string</code> |
520
- | **`cancelBtn`** | <code>string</code> |
521
-
636
+ #### CloseWebviewOptions
522
637
 
523
- #### String
638
+ | Prop | Type | Description | Default |
639
+ | ---------------- | -------------------- | -------------------------------------------------------- | ----------------- |
640
+ | **`isAnimated`** | <code>boolean</code> | Whether the webview closing is animated or not, ios only | <code>true</code> |
524
641
 
525
- Allows manipulation and formatting of text strings and determination and location of substrings within strings.
526
-
527
- | Prop | Type | Description |
528
- | ------------ | ------------------- | ------------------------------------------------------------ |
529
- | **`length`** | <code>number</code> | Returns the length of a <a href="#string">String</a> object. |
530
-
531
- | Method | Signature | Description |
532
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
533
- | **toString** | () =&gt; string | Returns a string representation of a string. |
534
- | **charAt** | (pos: number) =&gt; string | Returns the character at the specified index. |
535
- | **charCodeAt** | (index: number) =&gt; number | Returns the Unicode value of the character at the specified location. |
536
- | **concat** | (...strings: string[]) =&gt; string | Returns a string that contains the concatenation of two or more strings. |
537
- | **indexOf** | (searchString: string, position?: number \| undefined) =&gt; number | Returns the position of the first occurrence of a substring. |
538
- | **lastIndexOf** | (searchString: string, position?: number \| undefined) =&gt; number | Returns the last occurrence of a substring in the string. |
539
- | **localeCompare** | (that: string) =&gt; number | Determines whether two strings are equivalent in the current locale. |
540
- | **match** | (regexp: string \| <a href="#regexp">RegExp</a>) =&gt; <a href="#regexpmatcharray">RegExpMatchArray</a> \| null | Matches a string with a regular expression, and returns an array containing the results of that search. |
541
- | **replace** | (searchValue: string \| <a href="#regexp">RegExp</a>, replaceValue: string) =&gt; string | Replaces text in a string, using a regular expression or search string. |
542
- | **replace** | (searchValue: string \| <a href="#regexp">RegExp</a>, replacer: (substring: string, ...args: any[]) =&gt; string) =&gt; string | Replaces text in a string, using a regular expression or search string. |
543
- | **search** | (regexp: string \| <a href="#regexp">RegExp</a>) =&gt; number | Finds the first substring match in a regular expression search. |
544
- | **slice** | (start?: number \| undefined, end?: number \| undefined) =&gt; string | Returns a section of a string. |
545
- | **split** | (separator: string \| <a href="#regexp">RegExp</a>, limit?: number \| undefined) =&gt; string[] | Split a string into substrings using the specified separator and return them as an array. |
546
- | **substring** | (start: number, end?: number \| undefined) =&gt; string | Returns the substring at the specified location within a <a href="#string">String</a> object. |
547
- | **toLowerCase** | () =&gt; string | Converts all the alphabetic characters in a string to lowercase. |
548
- | **toLocaleLowerCase** | (locales?: string \| string[] \| undefined) =&gt; string | Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. |
549
- | **toUpperCase** | () =&gt; string | Converts all the alphabetic characters in a string to uppercase. |
550
- | **toLocaleUpperCase** | (locales?: string \| string[] \| undefined) =&gt; string | Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. |
551
- | **trim** | () =&gt; string | Removes the leading and trailing white space and line terminator characters from a string. |
552
- | **substr** | (from: number, length?: number \| undefined) =&gt; string | Gets a substring beginning at the specified location and having the specified length. |
553
- | **valueOf** | () =&gt; string | Returns the primitive value of the specified object. |
554
642
 
643
+ #### OpenWebViewOptions
555
644
 
556
- #### RegExpMatchArray
645
+ | Prop | Type | Description | Default | Since |
646
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------ |
647
+ | **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
648
+ | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
649
+ | **`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 |
650
+ | **`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 |
651
+ | **`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) | | 6.10.0 |
652
+ | **`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 |
653
+ | **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | 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 | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
654
+ | **`shareSubject`** | <code>string</code> | Subject text for sharing. Required when using shareDisclaimer. This text will be used as the subject line when sharing content. | | 0.1.0 |
655
+ | **`title`** | <code>string</code> | Title of the browser | <code>"New Window"</code> | 0.1.0 |
656
+ | **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> | Background color of the browser | <code>BackgroundColor.BLACK</code> | 0.1.0 |
657
+ | **`activeNativeNavigationForWebview`** | <code>boolean</code> | 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 | <code>false (Android), true (iOS - enabled by default)</code> | |
658
+ | **`disableGoBackOnNativeApplication`** | <code>boolean</code> | Disable the possibility to go back on native application, useful to force user to stay on the webview, Android only | <code>false</code> | |
659
+ | **`isPresentAfterPageLoad`** | <code>boolean</code> | 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. | <code>false</code> | 0.1.0 |
660
+ | **`isInspectable`** | <code>boolean</code> | Whether the website in the webview is inspectable or not, ios only | <code>false</code> | |
661
+ | **`isAnimated`** | <code>boolean</code> | Whether the webview opening is animated or not, ios only | <code>true</code> | |
662
+ | **`showReloadButton`** | <code>boolean</code> | Shows a reload button that reloads the web page | <code>false</code> | 1.0.15 |
663
+ | **`closeModal`** | <code>boolean</code> | CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately. | <code>false</code> | 1.1.0 |
664
+ | **`closeModalTitle`** | <code>string</code> | CloseModalTitle: title of the confirm when user clicks on close button | <code>"Close"</code> | 1.1.0 |
665
+ | **`closeModalDescription`** | <code>string</code> | CloseModalDescription: description of the confirm when user clicks on close button | <code>"Are you sure you want to close this window?"</code> | 1.1.0 |
666
+ | **`closeModalOk`** | <code>string</code> | CloseModalOk: text of the confirm button when user clicks on close button | <code>"Close"</code> | 1.1.0 |
667
+ | **`closeModalCancel`** | <code>string</code> | CloseModalCancel: text of the cancel button when user clicks on close button | <code>"Cancel"</code> | 1.1.0 |
668
+ | **`visibleTitle`** | <code>boolean</code> | visibleTitle: if true the website title would be shown else shown empty | <code>true</code> | 1.2.5 |
669
+ | **`toolbarColor`** | <code>string</code> | toolbarColor: color of the toolbar in hex format | <code>"#ffffff"</code> | 1.2.5 |
670
+ | **`toolbarTextColor`** | <code>string</code> | 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 | <code>calculated based on toolbarColor brightness</code> | 6.10.0 |
671
+ | **`showArrow`** | <code>boolean</code> | showArrow: if true an arrow would be shown instead of cross for closing the window | <code>false</code> | 1.2.5 |
672
+ | **`ignoreUntrustedSSLError`** | <code>boolean</code> | ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website. | <code>false</code> | 6.1.0 |
673
+ | **`preShowScript`** | <code>string</code> | 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) | | 6.6.0 |
674
+ | **`preShowScriptInjectionTime`** | <code>'documentStart' \| 'pageLoad'</code> | 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) | <code>"pageLoad"</code> | 7.26.0 |
675
+ | **`proxyRequests`** | <code>string</code> | proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only) | | 6.9.0 |
676
+ | **`buttonNearDone`** | <code>{ ios: { iconType: 'sf-symbol' \| 'asset'; icon: string; }; android: { iconType: 'asset' \| 'vector'; icon: string; width?: number; height?: number; }; }</code> | 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 | | 6.7.0 |
677
+ | **`textZoom`** | <code>number</code> | textZoom: sets the text zoom of the page in percent. Allows users to increase or decrease the text size for better readability. | <code>100</code> | 7.6.0 |
678
+ | **`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 |
679
+ | **`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 |
680
+ | **`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 |
681
+ | **`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> | |
682
+ | **`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 |
683
+ | **`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 |
684
+ | **`width`** | <code>number</code> | Width of the webview in pixels. If not set, webview will be fullscreen width. | <code>undefined (fullscreen)</code> | |
685
+ | **`height`** | <code>number</code> | Height of the webview in pixels. If not set, webview will be fullscreen height. | <code>undefined (fullscreen)</code> | |
686
+ | **`x`** | <code>number</code> | X position of the webview in pixels from the left edge. Only effective when width is set. | <code>0</code> | |
687
+ | **`y`** | <code>number</code> | Y position of the webview in pixels from the top edge. Only effective when height is set. | <code>0</code> | |
557
688
 
558
- | Prop | Type |
559
- | ----------- | ------------------- |
560
- | **`index`** | <code>number</code> |
561
- | **`input`** | <code>string</code> |
562
689
 
690
+ #### Headers
563
691
 
564
- #### RegExp
565
692
 
566
- | Prop | Type | Description |
567
- | ---------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
568
- | **`source`** | <code>string</code> | Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. |
569
- | **`global`** | <code>boolean</code> | Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. |
570
- | **`ignoreCase`** | <code>boolean</code> | Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. |
571
- | **`multiline`** | <code>boolean</code> | Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. |
572
- | **`lastIndex`** | <code>number</code> | |
693
+ #### Credentials
573
694
 
574
- | Method | Signature | Description |
575
- | ----------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
576
- | **exec** | (string: string) =&gt; <a href="#regexpexecarray">RegExpExecArray</a> \| null | Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. |
577
- | **test** | (string: string) =&gt; boolean | Returns a Boolean value that indicates whether or not a pattern exists in a searched string. |
578
- | **compile** | () =&gt; this | |
695
+ | Prop | Type |
696
+ | -------------- | ------------------- |
697
+ | **`username`** | <code>string</code> |
698
+ | **`password`** | <code>string</code> |
579
699
 
580
700
 
581
- #### RegExpExecArray
701
+ #### DisclaimerOptions
582
702
 
583
- | Prop | Type |
584
- | ----------- | ------------------- |
585
- | **`index`** | <code>number</code> |
586
- | **`input`** | <code>string</code> |
703
+ | Prop | Type | Description | Default |
704
+ | ---------------- | ------------------- | -------------------------------------- | ---------------------- |
705
+ | **`title`** | <code>string</code> | Title of the disclaimer dialog | <code>"Title"</code> |
706
+ | **`message`** | <code>string</code> | Message shown in the disclaimer dialog | <code>"Message"</code> |
707
+ | **`confirmBtn`** | <code>string</code> | Text for the confirm button | <code>"Confirm"</code> |
708
+ | **`cancelBtn`** | <code>string</code> | Text for the cancel button | <code>"Cancel"</code> |
587
709
 
588
710
 
589
711
  #### PluginListenerHandle
@@ -607,6 +729,16 @@ Allows manipulation and formatting of text strings and determination and locatio
607
729
  | **`url`** | <code>string</code> | Emit when a button is clicked. | 0.0.1 |
608
730
 
609
731
 
732
+ #### DimensionOptions
733
+
734
+ | Prop | Type | Description |
735
+ | ------------ | ------------------- | --------------------------------------- |
736
+ | **`width`** | <code>number</code> | Width of the webview in pixels |
737
+ | **`height`** | <code>number</code> | Height of the webview in pixels |
738
+ | **`x`** | <code>number</code> | X position from the left edge in pixels |
739
+ | **`y`** | <code>number</code> | Y position from the top edge in pixels |
740
+
741
+
610
742
  ### Type Aliases
611
743
 
612
744
 
@@ -655,7 +787,7 @@ Construct a type with a set of properties K of type T
655
787
 
656
788
  #### ButtonNearListener
657
789
 
658
- <code>(state: {}): void</code>
790
+ <code>(state: object): void</code>
659
791
 
660
792
 
661
793
  #### ConfirmBtnListener
@@ -668,20 +800,20 @@ Construct a type with a set of properties K of type T
668
800
 
669
801
  #### ToolBarType
670
802
 
671
- | Members | Value |
672
- | ---------------- | ------------------------- |
673
- | **`ACTIVITY`** | <code>"activity"</code> |
674
- | **`NAVIGATION`** | <code>"navigation"</code> |
675
- | **`BLANK`** | <code>"blank"</code> |
676
- | **`DEFAULT`** | <code>""</code> |
803
+ | Members | Value | Description | Since |
804
+ | ---------------- | ------------------------- | ---------------------------------------------------------------- | ----- |
805
+ | **`ACTIVITY`** | <code>'activity'</code> | Shows a simple toolbar with just a close button and share button | 0.1.0 |
806
+ | **`COMPACT`** | <code>'compact'</code> | Shows a simple toolbar with just a close button | 7.6.8 |
807
+ | **`NAVIGATION`** | <code>'navigation'</code> | Shows a full navigation toolbar with back/forward buttons | 0.1.0 |
808
+ | **`BLANK`** | <code>'blank'</code> | Shows no toolbar | 0.1.0 |
677
809
 
678
810
 
679
811
  #### BackgroundColor
680
812
 
681
813
  | Members | Value |
682
814
  | ----------- | -------------------- |
683
- | **`WHITE`** | <code>"white"</code> |
684
- | **`BLACK`** | <code>"black"</code> |
815
+ | **`WHITE`** | <code>'white'</code> |
816
+ | **`BLACK`** | <code>'black'</code> |
685
817
 
686
818
  </docgen-api>
687
819