cordova-plugin-ionic-webview
Advanced tools
Comparing version 2.3.1 to 3.0.0
@@ -0,1 +1,29 @@ | ||
# [3.0.0](https://github.com/ionic-team/cordova-plugin-ionic-webview/compare/v2.3.1...v3.0.0) (2019-01-03) | ||
### Bug Fixes | ||
* **iOS:** Remove unused code ([#247](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/247)) ([bceb17a](https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/bceb17a)) | ||
### Features | ||
* Allows configuration of Mixed Content Mode ([#240](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/240)) ([486d412](https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/486d412)), closes [#231](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/231) | ||
* **Android:** Implement ionic-file and ionic-content urls ([#242](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/242)) ([8ef0c30](https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/8ef0c30)), closes [#204](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/204) [#183](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/183) | ||
* **iOS:** Remove GCDWebServer ([#244](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/244)) ([0dee0cf](https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/0dee0cf)) | ||
* **WebViewLocalServer.java:** return 404 error code when a local file is not found ([#217](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/217)) ([f7a551e](https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/f7a551e)), closes [#216](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/216) | ||
### BREAKING CHANGES | ||
* **iOS:** Sets deployment-target to 11, so will only work on iOS 11+ | ||
* Address changes | ||
* changes the default from 1 (never) to 0 (always) | ||
* **WebViewLocalServer.java:** Until now, the Android part of the plugin was returning a 200 http code even though | ||
the requested file didn't exist. This behavior was inconsistent with the historical behavior of the | ||
iOS webView. This change makes them both work in the same manner but introduces a breaking change | ||
for the current Android users that are expecting a 200 http code no matter what and are testing the | ||
not found error just by checking if the body is null. | ||
## [2.3.1](https://github.com/ionic-team/cordova-plugin-ionic-webview/compare/v2.3.0...v2.3.1) (2018-12-06) | ||
@@ -2,0 +30,0 @@ |
{ | ||
"name": "cordova-plugin-ionic-webview", | ||
"version": "2.3.1", | ||
"version": "3.0.0", | ||
"description": "Ionic Web View Engine Plugin", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -30,6 +30,5 @@ <!-- | ||
This plugin defaults to using WKWebView on iOS and the latest evergreen webview on Android. Additionally, this plugin makes it easy to use HTML5 style routing | ||
that web developers expect for building single-page apps. | ||
This plugin uses WKWebView on iOS and the latest evergreen webview on Android. Additionally, this plugin makes it easy to use HTML5 style routing that web developers expect for building single-page apps. | ||
Note: This repo and its documentation are for `cordova-plugin-ionic-webview` @ `2.x`, which uses the new features that may not work with all apps. See [Requirements](#requirements) and [Migrating to 2.x](#migrating-to-2x). | ||
Note: This repo and its documentation are for `cordova-plugin-ionic-webview` @ `3.x`, which uses the new features that may not work with all apps. See [Requirements](#requirements) and [Migrating to 3.x](#migrating-to-3x). | ||
@@ -44,40 +43,43 @@ :book: **Documentation**: [https://beta.ionicframework.com/docs/building/webview][ionic-webview-docs] | ||
This plugin has several configuration options that can be set in `config.xml`. Important: some configuration options should be adjusted for production apps, especially `WKPort`: | ||
This plugin has several configuration options that can be set in `config.xml`. | ||
### iOS and Android Preferences | ||
### Android and iOS Preferences | ||
Preferences available for both iOS and Android platforms | ||
Preferences available for both iOS and Android | ||
#### WKPort | ||
#### Hostname | ||
```xml | ||
<preference name="WKPort" value="8080" /> | ||
``` | ||
`<preference name="Hostname" value="app" />` | ||
The default port the server will listen on. _You should change this to a random port number!_ | ||
Default value is `localhost`. | ||
### iOS Preferences | ||
Example `ionic://app` on iOS, `http://app` on Android. | ||
Preferences only available for iOS platform | ||
If you change it, you'll need to add a new `allow-navigation` entry in the `config.xml` for the configured url (i.e `<allow-navigation href="http://app/*"/>` if `Hostname` is set to `app`). | ||
This is only needed for the Android url as it uses `http://`, all `ionic://` urls are whitelisted by the plugin. | ||
#### UseScheme | ||
### Android Preferences | ||
`<preference name="UseScheme" value="true" />` | ||
Preferences only available Android platform | ||
Default value is `false`. | ||
#### MixedContentMode | ||
On iOS 11 and newer it will use a `WKURLSchemeHandler` that loads the app from `ionic://` scheme instead of using the local web server and `https://` scheme. | ||
```xml | ||
<preference name="MixedContentMode" value="2" /> | ||
``` | ||
On iOS 10 and older will continue using the local web server even if the preference is set to `true`. | ||
Configures the WebView's behavior when an origin attempts to load a resource from a different origin. | ||
#### HostName | ||
Default value is `0` (`MIXED_CONTENT_ALWAYS_ALLOW`), which allows loading resources from other origins. | ||
`<preference name="HostName" value="myHostName" />` | ||
Other possible values are `1` (`MIXED_CONTENT_NEVER_ALLOW`) and `2` (`MIXED_CONTENT_COMPATIBILITY_MODE`) | ||
Default value is `app`. | ||
If `UseScheme` is set to yes, it will use the `HostName` value as the host of the starting url. | ||
[Android documentation](https://developer.android.com/reference/android/webkit/WebSettings.html#setMixedContentMode(int)) | ||
Example `ionic://app` | ||
### iOS Preferences | ||
Preferences only available for iOS platform | ||
#### WKSuspendInBackground | ||
@@ -89,21 +91,4 @@ | ||
Whether to try to keep the server running when the app is backgrounded. Note: the server will likely be suspended by the OS after a few minutes. In particular, long-lived background tasks are not allowed on iOS outside of select audio and geolocation tasks. | ||
Set to false to stop WKWebView suspending in background too eagerly. | ||
#### WKBind | ||
```xml | ||
<preference name="WKBind" value="localhost" /> | ||
``` | ||
The hostname the server will bind to. There aren't a lot of other valid options, but some prefer binding to "127.0.0.1" | ||
#### WKInternalConnectionsOnly (New in 2.2.0) | ||
```xml | ||
<preference name="WKInternalConnectionsOnly" value="true" /> | ||
``` | ||
Whether to restrict access to this server to the app itself. Previous versions of this plugin did not restrict access to the app itself. In 2.2.0 and above, | ||
the plugin now restricts access to only the app itself. | ||
#### KeyboardAppearanceDark | ||
@@ -119,6 +104,6 @@ | ||
* **iOS**: iOS 10+ and `cordova-ios` 4+ | ||
* **iOS**: iOS 11+ and `cordova-ios` 4+ | ||
* **Android**: Android 4.4+ and `cordova-android` 6.4+ | ||
## Migrating to 2.x | ||
## Migrating to 3.x | ||
@@ -134,4 +119,8 @@ 1. Remove and re-add the Web View plugin: | ||
* The origin for requests from the Web View is `http://localhost:8080`. | ||
* The default origin for requests from the Android WebView is `http://localhost`. If `Hostname` preference is set, then origin will be `http://HostnameValue`. | ||
1. Apps are now served from `ionic://` scheme on iOS. | ||
* The default origin for requests from the iOS WebView is `ionic://localhost`. If `Hostname` preference is set, then origin will be `ionic://HostnameValue`. | ||
1. Replace any usages of `window.Ionic.normalizeURL()` with `window.Ionic.WebView.convertFileSrc()`. | ||
@@ -138,0 +127,0 @@ |
@@ -8,13 +8,10 @@ var exec = require('cordova/exec'); | ||
} | ||
if (!url.startsWith('file://')) { | ||
return url; | ||
if (url.startsWith('file://')) { | ||
return url.replace('file', window.WEBVIEW_FILE_PREFIX); | ||
} | ||
if (window.WEBVIEW_SERVER_URL.startsWith('ionic://')) { | ||
return url.replace('file', 'ionic-asset'); | ||
if (url.startsWith('content://')) { | ||
return url.replace('content://', window.WEBVIEW_CONTENT_PREFIX + ':///'); | ||
} | ||
url = url.substr(7); // len("file://") == 7 | ||
if (url.length === 0 || url[0] !== '/') { // ensure the new URL starts with / | ||
url = '/' + url; | ||
} | ||
return window.WEBVIEW_SERVER_URL + '/_file_' + url; | ||
return url; | ||
}, | ||
@@ -21,0 +18,0 @@ setServerBasePath: function(path) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125441
24
220
133