You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opens an `url` in a new `InAppBrowser` instance or the system browser.
@@ -165,17 +167,13 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser.
165
167
166
168
-`headers`: The additional headers to be used in the HTTP request for this URL, specified as a map from name to value.
167
169
168
-
-`target`: The target in which to load the `url`, an optional parameter that defaults to `_self`.
169
-
170
-
-`_self`: Opens in the `InAppBrowser`.
171
-
-`_blank`: Opens in the `InAppBrowser`.
172
-
-`_system`: Opens in the system's web browser.
173
-
174
170
-`options`: Options for the `InAppBrowser`.
175
171
176
172
All platforms support:
177
173
-__useShouldOverrideUrlLoading__: Set to `true` to be able to listen at the `shouldOverrideUrlLoading` event. The default value is `false`.
178
174
-__useOnLoadResource__: Set to `true` to be able to listen at the `onLoadResource()` event. The default value is `false`.
175
+
-__openWithSystemBrowser__: Set to `true` to open the given `url` with the system browser. The default value is `false`.
176
+
-__isLocalFile__: Set to `true` if the `url` is pointing to a local file (the file must be addded in the `assets` section of your `pubspec.yaml`. See `loadFile()` explanation). The default value is `false`.
179
177
-__clearCache__: Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`.
180
178
-__userAgent___: Set the custom WebView's user-agent.
181
179
-__javaScriptEnabled__: Set to `true` to enable JavaScript. The default value is `true`.
@@ -185,9 +183,9 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser.
185
183
-__toolbarTopBackgroundColor__: Set the custom background color of the toolbat at the top.
186
184
-__hideUrlBar__: Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
187
185
-__mediaPlaybackRequiresUserGesture__: Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`.
188
-
186
+
189
187
**Android** supports these additional options:
190
-
188
+
191
189
-__hideTitleBar__: Set to `true` if you want the title should be displayed. The default value is `false`.
192
190
-__closeOnCannotGoBack__: Set to `false` to not close the InAppBrowser when the user click on the back button and the WebView cannot go back to the history. The default value is `true`.
193
191
-__clearSessionCache__: Set to `true` to have the session cookie cache cleared before the new window is opened.
@@ -200,14 +198,14 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser.
200
198
-__progressBar__: Set to `false` to hide the progress bar at the bottom of the toolbar at the top. The default value is `true`.
201
199
202
200
**iOS** supports these additional options:
203
-
201
+
204
202
-__disallowOverScroll__: Set to `true` to disable the bouncing of the WebView when the scrolling has reached an edge of the content. The default value is `false`.
205
203
-__toolbarBottom__: Set to `false` to hide the toolbar at the bottom of the WebView. The default value is `true`.
206
204
-__toolbarBottomBackgroundColor__: Set the custom background color of the toolbat at the bottom.
207
205
-__toolbarBottomTranslucent__: Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
208
206
-__closeButtonCaption__: Set the custom text for the close button.
209
207
-__closeButtonColor__: Set the custom color for the close button.
210
-
-__presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles.
208
+
-__presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles.
211
209
-__transitionStyle__: Set to the custom transition style when presenting the WebView. The default value is `0 //crossDissolve`. See [UIModalTransitionStyle](https://developer.apple.com/documentation/uikit/uimodaltransitionStyle) for all the available styles.
212
210
-__enableViewportScale__: Set to `true` to allow a viewport meta tag to either disable or restrict the range of user scaling. The default value is `false`.
213
211
-__suppressesIncrementalRendering__: Set to `true` if you want the WebView suppresses content rendering until it is fully loaded into memory.. The default value is `false`.
@@ -218,7 +216,7 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser.
218
216
-__allowsInlineMediaPlayback__: Set to `true` to allow HTML5 media playback to appear inline within the screen layout, using browser-supplied controls rather than native controls. For this to work, add the `webkit-playsinline` attribute to any `<video>` elements. The default value is `false`.
219
217
-__allowsPictureInPictureMediaPlayback__: Set to `true` to allow HTML5 videos play picture-in-picture. The default value is `true`.
220
218
-__spinner__: Set to `false` to hide the spinner when the WebView is loading a page. The default value is `true`.
This is a static method that opens an `url` in the system browser.
237
+
This has the same behaviour of an `InAppBrowser` instance calling the `open()` method with option `openWithSystemBrowser: true`.
238
+
239
+
```dart
240
+
InAppBrowser.openWithSystemBrowser(String url);
241
+
```
242
+
243
+
#### Future\<void\> InAppBrowser.openOnLocalhost
244
+
245
+
Serve the `assetFilePath` from Flutter assets on http://localhost:`port`/. It is similar to `InAppBrowser.open()` with option `isLocalFile: true`, but it starts a server.
246
+
247
+
**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file (See [ATS Configuration Basics](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35):
248
+
```xml
249
+
<key>NSAppTransportSecurity</key>
250
+
<dict>
251
+
<key>NSAllowsLocalNetworking</key>
252
+
<true/>
253
+
</dict>
254
+
```
255
+
The `NSAllowsLocalNetworking` key is available since **iOS 10**.
Loads the given `assetFilePath` with optional `headers` specified as a map from name to value.
336
+
337
+
To be able to load your local files (assets, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found!
338
+
339
+
Example of a `pubspec.yaml` file:
340
+
```yaml
341
+
...
342
+
343
+
# The following section is specific to Flutter.
344
+
flutter:
345
+
346
+
# The following line ensures that the Material Icons font is
347
+
# included with your application, so that you can use the icons in
Injects JavaScript code into the `InAppBrowser` window and returns the result of the evaluation. (Only available when the target is set to `_blank` or to `_self`)
443
+
Injects JavaScript code into the `InAppBrowser` window and returns the result of the evaluation.
383
444
384
445
```dart
385
446
inAppBrowser.injectScriptCode(String source);
386
-
```
447
+
```
387
448
388
449
#### Future\<void\> InAppBrowser.injectScriptFile
389
450
390
-
Injects a JavaScript file into the `InAppBrowser` window. (Only available when the target is set to `_blank` or to `_self`)
451
+
Injects a JavaScript file into the `InAppBrowser` window.
391
452
392
453
```dart
393
454
inAppBrowser.injectScriptFile(String urlFile);
394
-
```
455
+
```
395
456
396
457
#### Future\<void\> InAppBrowser.injectStyleCode
397
458
398
-
Injects CSS into the `InAppBrowser` window. (Only available when the target is set to `_blank` or to `_self`)
459
+
Injects CSS into the `InAppBrowser` window.
399
460
400
461
```dart
401
462
inAppBrowser.injectStyleCode(String source);
402
-
```
463
+
```
403
464
404
465
#### Future\<void\> InAppBrowser.injectStyleFile
405
466
406
-
Injects a CSS file into the `InAppBrowser` window. (Only available when the target is set to `_blank` or to `_self`)
467
+
Injects a CSS file into the `InAppBrowser` window.
407
468
408
469
```dart
409
470
inAppBrowser.injectStyleFile(String urlFile);
@@ -462,13 +523,13 @@ class MyInAppBrowser extends InAppBrowser {
462
523
void onExit() {
463
524
print("\n\nBrowser closed!\n\n");
464
525
}
465
-
526
+
466
527
}
467
528
468
529
MyInAppBrowser inAppBrowserFallback = new MyInAppBrowser();
469
530
470
531
class MyChromeSafariBrowser extends ChromeSafariBrowser {
0 commit comments