diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 000000000..6eea8b6a2
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,29 @@
+# appveyor file
+# http://www.appveyor.com/docs/appveyor-yml
+
+max_jobs: 1
+
+shallow_clone: true
+
+init:
+ - git config --global core.autocrlf true
+
+image:
+ - Visual Studio 2017
+
+environment:
+ nodejs_version: "4"
+ matrix:
+ - PLATFORM: windows-10-store
+ JUST_BUILD: --justBuild
+ - PLATFORM: local\browser
+install:
+ - npm cache clean -f
+ - node --version
+ - npm install -g cordova-paramedic@https://github.com/apache/cordova-paramedic.git
+ - npm install -g cordova
+
+build: off
+
+test_script:
+ - cordova-paramedic --config pr\%PLATFORM% --plugin . %JUST_BUILD%
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..91582f4ef
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,22 @@
+
+
+### Platforms affected
+
+
+### What does this PR do?
+
+
+### What testing has been done on this change?
+
+
+### Checklist
+- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
+- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
+- [ ] Added automated test coverage as appropriate for this change.
diff --git a/.travis.yml b/.travis.yml
index b9af4c58b..082f00fa0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,83 @@
-language: node_js
sudo: false
-node_js:
- - "4.2"
+addons:
+ jwt:
+ secure: TZ88IEvAw1bsWPWxvDzXdpi2NK0i3PN4hG15+vDpIt6wXGVPknjxuXWJeLj7TqBpAIvP7XDfS8ZvHVPLe7fe8oOchZPLuiDw9VVIk6cnHjE6wpoavdGc/1mDJ3Bi4PDcHwRUr5ng5spYQqqlTwcECkH/q7iPgudiFM6rlOlGRyA=
+env:
+ global:
+ - SAUCE_USERNAME=snay
+ - TRAVIS_NODE_VERSION="4.2"
+matrix:
+ include:
+ - env: PLATFORM=browser-chrome
+ os: linux
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=browser-firefox
+ os: linux
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=browser-safari
+ os: linux
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=browser-edge
+ os: linux
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=ios-9.3
+ os: osx
+ osx_image: xcode7.3
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=ios-10.0
+ os: osx
+ osx_image: xcode7.3
+ language: node_js
+ node_js: '4.2'
+ - env: PLATFORM=android-4.4
+ os: linux
+ language: android
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+ - env: PLATFORM=android-5.1
+ os: linux
+ language: android
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+ - env: PLATFORM=android-6.0
+ os: linux
+ language: android
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+ - env: PLATFORM=android-7.0
+ os: linux
+ language: android
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+before_install:
+- npm cache clean -f
+- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm
+ && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm
+ install $TRAVIS_NODE_VERSION
+- node --version
+- if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
+- if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
+- if [[ "$PLATFORM" =~ android ]]; then echo y | android update sdk -u --filter android-22,android-23,android-24,android-25;
+ fi
+- git clone https://github.com/apache/cordova-paramedic /tmp/paramedic && pushd /tmp/paramedic
+ && npm install && popd
+- npm install -g cordova
+install:
+- npm install
+script:
+- npm test
+- node /tmp/paramedic/main.js --config pr/$PLATFORM --plugin $(pwd) --shouldUseSauce
+ --buildName travis-plugin-inappbrowser-$TRAVIS_JOB_NUMBER
diff --git a/README.md b/README.md
index 8020ce32b..fc4673b4c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
+---
+title: Inappbrowser
+description: Open an in-app browser window.
+---
-[![Build Status](https://travis-ci.org/apache/cordova-plugin-inappbrowser.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-inappbrowser)
+|AppVeyor|Travis CI|
+|:-:|:-:|
+|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-inappbrowser?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-inappbrowser)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-inappbrowser.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-inappbrowser)|
# cordova-plugin-inappbrowser
+You can show helpful articles, videos, and web resources inside of your app. Users can view web pages without leaving your app.
+
+> To get a few ideas, check out the [sample](#sample) at the bottom of this page or go straight to the [reference](#reference) content.
+
This plugin provides a web browser view that displays when calling `cordova.InAppBrowser.open()`.
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
@@ -56,10 +66,10 @@ Although `window.open` is in the global scope, InAppBrowser is not available unt
console.log("window.open works well");
}
-Report issues with this plugin on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20InAppBrowser%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
-
+Report issues with this plugin on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22cordova-plugin-inappbrowser%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
+## Reference
## Installation
cordova plugin add cordova-plugin-inappbrowser
@@ -79,7 +89,7 @@ instance, or the system browser.
var ref = cordova.InAppBrowser.open(url, target, options);
-- __ref__: Reference to the `InAppBrowser` window. _(InAppBrowser)_
+- __ref__: Reference to the `InAppBrowser` window when the target is set to `'_blank'`. _(InAppBrowser)_
- __url__: The URL to load _(String)_. Call `encodeURI()` on this if the URL contains Unicode characters.
@@ -91,26 +101,30 @@ instance, or the system browser.
- __options__: Options for the `InAppBrowser`. Optional, defaulting to: `location=yes`. _(String)_
- The `options` string must not contain any blank space, and each feature's name/value pairs must be separated by a comma. Feature names are case insensitive. All platforms support the value below:
+ The `options` string must not contain any blank space, and each feature's name/value pairs must be separated by a comma. Feature names are case insensitive.
+
+ All platforms support:
- __location__: Set to `yes` or `no` to turn the `InAppBrowser`'s location bar on or off.
- Android only:
+ Android supports these additional options:
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
- __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened
- __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
- - __zoom__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `yes`.
- __hardwareback__: set to `yes` to use the hardware back button to navigate backwards through the `InAppBrowser`'s history. If there is no previous page, the `InAppBrowser` will close. The default value is `yes`, so you must set it to `no` if you want the back button to simply close the InAppBrowser.
+ - __zoom__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `yes`.
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
+ - __shouldPauseOnSuspend__: Set to `yes` to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues like described in [CB-11013](https://issues.apache.org/jira/browse/CB-11013)).
+ - __useWideViewPort__: Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is `no`, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is `yes` and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. (defaults to `yes`).
- iOS only:
+ iOS supports these additional options:
- - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself.
- - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property.
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
- __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened
- - __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
+ - __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
+ - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself.
+ - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property.
- __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`)
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`).
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
@@ -121,21 +135,24 @@ instance, or the system browser.
- __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`).
- __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window.
- Windows only:
+ Windows supports these additional options:
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
+ - __hardwareback__: works the same way as on Android platform.
- __fullscreen__: set to `yes` to create the browser control without a border around it. Please note that if __location=no__ is also specified, there will be no control presented to user to close IAB window.
+
### Supported Platforms
- Amazon Fire OS
- Android
- BlackBerry 10
+- Browser
- Firefox OS
- iOS
+- OSX
- Windows 8 and 8.1
- Windows Phone 7 and 8
-- Browser
### Example
@@ -173,6 +190,12 @@ opened with `target='_blank'`. The rules might look like these
}
```
+### OSX Quirks
+
+At the moment the only supported target in OSX is `_system`.
+
+`_blank` and `_self` targets are not yet implemented and are ignored silently. Pull requests and patches to get these to work are greatly appreciated.
+
### Windows Quirks
Windows 8.0, 8.1 and Windows Phone 8.1 don't support remote urls to be opened in the Cordova WebView so remote urls are always showed in the system's web browser if opened with `target='_self'`.
@@ -189,7 +212,7 @@ Similar to Firefox OS IAB window visual behaviour can be overridden via `inAppBr
## InAppBrowser
-The object returned from a call to `cordova.InAppBrowser.open`.
+The object returned from a call to `cordova.InAppBrowser.open` when the target is set to `'_blank'`.
### Methods
@@ -197,12 +220,13 @@ The object returned from a call to `cordova.InAppBrowser.open`.
- removeEventListener
- close
- show
+- hide
- executeScript
- insertCSS
## InAppBrowser.addEventListener
-> Adds a listener for an event from the `InAppBrowser`.
+> Adds a listener for an event from the `InAppBrowser`. (Only available when the target is set to `'_blank'`)
ref.addEventListener(eventname, callback);
@@ -217,6 +241,76 @@ The object returned from a call to `cordova.InAppBrowser.open`.
- __callback__: the function that executes when the event fires. The function is passed an `InAppBrowserEvent` object as a parameter.
+## Example
+
+```javascript
+
+var inAppBrowserRef;
+
+function showHelp(url) {
+
+ var target = "_blank";
+
+ var options = "location=yes,hidden=yes";
+
+ inAppBrowserRef = cordova.InAppBrowser.open(url, target, options);
+
+ inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
+
+ inAppBrowserRef.addEventListener('loadstop', loadStopCallBack);
+
+ inAppBrowserRef.addEventListener('loaderror', loadErrorCallBack);
+
+}
+
+function loadStartCallBack() {
+
+ $('#status-message').text("loading please wait ...");
+
+}
+
+function loadStopCallBack() {
+
+ if (inAppBrowserRef != undefined) {
+
+ inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;" });
+
+ $('#status-message').text("");
+
+ inAppBrowserRef.show();
+ }
+
+}
+
+function loadErrorCallBack(params) {
+
+ $('#status-message').text("");
+
+ var scriptErrorMesssage =
+ "alert('Sorry we cannot open that page. Message from the server is : "
+ + params.message + "');"
+
+ inAppBrowserRef.executeScript({ code: scriptErrorMesssage }, executeScriptCallBack);
+
+ inAppBrowserRef.close();
+
+ inAppBrowserRef = undefined;
+
+}
+
+function executeScriptCallBack(params) {
+
+ if (params[0] == null) {
+
+ $('#status-message').text(
+ "Sorry we couldn't open that page. Message from the server is : '"
+ + params.message + "'");
+ }
+
+}
+
+```
+
### InAppBrowserEvent Properties
- __type__: the eventname, either `loadstart`, `loadstop`, `loaderror`, or `exit`. _(String)_
@@ -232,10 +326,10 @@ The object returned from a call to `cordova.InAppBrowser.open`.
- Amazon Fire OS
- Android
+- Browser
- iOS
- Windows 8 and 8.1
- Windows Phone 7 and 8
-- Browser
### Browser Quirks
@@ -248,7 +342,7 @@ The object returned from a call to `cordova.InAppBrowser.open`.
## InAppBrowser.removeEventListener
-> Removes a listener for an event from the `InAppBrowser`.
+> Removes a listener for an event from the `InAppBrowser`. (Only available when the target is set to `'_blank'`)
ref.removeEventListener(eventname, callback);
@@ -268,10 +362,10 @@ The function is passed an `InAppBrowserEvent` object.
- Amazon Fire OS
- Android
+- Browser
- iOS
- Windows 8 and 8.1
- Windows Phone 7 and 8
-- Browser
### Quick Example
@@ -292,11 +386,11 @@ The function is passed an `InAppBrowserEvent` object.
- Amazon Fire OS
- Android
+- Browser
- Firefox OS
- iOS
- Windows 8 and 8.1
- Windows Phone 7 and 8
-- Browser
### Quick Example
@@ -315,9 +409,9 @@ The function is passed an `InAppBrowserEvent` object.
- Amazon Fire OS
- Android
+- Browser
- iOS
- Windows 8 and 8.1
-- Browser
### Quick Example
@@ -325,9 +419,30 @@ The function is passed an `InAppBrowserEvent` object.
// some time later...
ref.show();
+## InAppBrowser.hide
+
+> Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden.
+
+ ref.hide();
+
+- __ref__: reference to the InAppBrowser window (`InAppBrowser`)
+
+### Supported Platforms
+
+- Amazon Fire OS
+- Android
+- iOS
+- Windows 8 and 8.1
+
+### Quick Example
+
+ var ref = cordova.InAppBrowser.open('http://apache.org', '_blank');
+ // some time later...
+ ref.hide();
+
## InAppBrowser.executeScript
-> Injects JavaScript code into the `InAppBrowser` window
+> Injects JavaScript code into the `InAppBrowser` window. (Only available when the target is set to `'_blank'`)
ref.executeScript(details, callback);
@@ -348,9 +463,9 @@ The function is passed an `InAppBrowserEvent` object.
- Amazon Fire OS
- Android
+- Browser
- iOS
- Windows 8 and 8.1
-- Browser
### Quick Example
@@ -369,7 +484,7 @@ Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.cont
## InAppBrowser.insertCSS
-> Injects CSS into the `InAppBrowser` window.
+> Injects CSS into the `InAppBrowser` window. (Only available when the target is set to `'_blank'`)
ref.insertCSS(details, callback);
@@ -394,3 +509,204 @@ Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.cont
ref.addEventListener('loadstop', function() {
ref.insertCSS({file: "mystyles.css"});
});
+__
+
+## Sample: Show help pages with an InAppBrowser
+
+You can use this plugin to show helpful documentation pages within your app. Users can view online help documents and then close them without leaving the app.
+
+Here's a few snippets that show how you do this.
+
+* [Give users a way to ask for help](#give).
+* [Load a help page](#load).
+* [Let users know that you're getting their page ready](#let).
+* [Show the help page](#show).
+* [Handle page errors](#handle).
+
+### Give users a way to ask for help
+
+There's lots of ways to do this in your app. A drop down list is a simple way to do that.
+
+```html
+
+
+
+```
+
+Gather the users choice in the ``onDeviceReady`` function of the page and then send an appropriate URL to a helper function in some shared library file. Our helper function is named ``showHelp()`` and we'll write that function next.
+
+```javascript
+
+$('#help-select').on('change', function (e) {
+
+ var url;
+
+ switch (this.value) {
+
+ case "article":
+ url = "https://cordova.apache.org/docs/en/latest/"
+ + "reference/cordova-plugin-inappbrowser/index.html";
+ break;
+
+ case "video":
+ url = "https://youtu.be/F-GlVrTaeH0";
+ break;
+
+ case "search":
+ url = "https://www.google.com/#q=inAppBrowser+plugin";
+ break;
+ }
+
+ showHelp(url);
+
+});
+
+```
+
+### Load a help page
+
+We'll use the ``open`` function to load the help page. We're setting the ``hidden`` property to ``yes`` so that we can show the browser only after the page content has loaded. That way, users don't see a blank browser while they wait for content to appear. When the ``loadstop`` event is raised, we'll know when the content has loaded. We'll handle that event shortly.
+
+```javascript
+
+function showHelp(url) {
+
+ var target = "_blank";
+
+ var options = "location=yes,hidden=yes";
+
+ inAppBrowserRef = cordova.InAppBrowser.open(url, target, options);
+
+ inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
+
+ inAppBrowserRef.addEventListener('loadstop', loadStopCallBack);
+
+ inAppBrowserRef.addEventListener('loaderror', loadErrorCallBack);
+
+}
+
+```
+
+### Let users know that you're getting their page ready
+
+Because the browser doesn't immediately appear, we can use the ``loadstart`` event to show a status message, progress bar, or other indicator. This assures users that content is on the way.
+
+```javascript
+
+function loadStartCallBack() {
+
+ $('#status-message').text("loading please wait ...");
+
+}
+
+```
+
+### Show the help page
+
+When the ``loadstopcallback`` event is raised, we know that the content has loaded and we can make the browser visible. This sort of trick can create the impression of better performance. The truth is that whether you show the browser before content loads or not, the load times are exactly the same.
+
+```javascript
+
+function loadStopCallBack() {
+
+ if (inAppBrowserRef != undefined) {
+
+ inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;" });
+
+ $('#status-message').text("");
+
+ inAppBrowserRef.show();
+ }
+
+}
+
+```
+You might have noticed the call to the ``insertCSS`` function. This serves no particular purpose in our scenario. But it gives you an idea of why you might use it. In this case, we're just making sure that the font size of your pages have a certain size. You can use this function to insert any CSS style elements. You can even point to a CSS file in your project.
+
+### Handle page errors
+
+Sometimes a page no longer exists, a script error occurs, or a user lacks permission to view the resource. How or if you handle that situation is completely up to you and your design. You can let the browser show that message or you can present it in another way.
+
+We'll try to show that error in a message box. We can do that by injecting a script that calls the ``alert`` function. That said, this won't work in browsers on Windows devices so we'll have to look at the parameter of the ``executeScript`` callback function to see if our attempt worked. If it didn't work out for us, we'll just show the error message in a ``
`` on the page.
+
+```javascript
+
+function loadErrorCallBack(params) {
+
+ $('#status-message').text("");
+
+ var scriptErrorMesssage =
+ "alert('Sorry we cannot open that page. Message from the server is : "
+ + params.message + "');"
+
+ inAppBrowserRef.executeScript({ code: scriptErrorMesssage }, executeScriptCallBack);
+
+ inAppBrowserRef.close();
+
+ inAppBrowserRef = undefined;
+
+}
+
+function executeScriptCallBack(params) {
+
+ if (params[0] == null) {
+
+ $('#status-message').text(
+ "Sorry we couldn't open that page. Message from the server is : '"
+ + params.message + "'");
+ }
+
+}
+
+```
+
+## More Usage Info
+
+### Local Urls ( source is in the app package )
+```
+var iab = cordova.InAppBrowser;
+
+iab.open('local-url.html'); // loads in the Cordova WebView
+iab.open('local-url.html', '_self'); // loads in the Cordova WebView
+iab.open('local-url.html', '_system'); // Security error: system browser, but url will not load (iOS)
+iab.open('local-url.html', '_blank'); // loads in the InAppBrowser
+iab.open('local-url.html', 'random_string'); // loads in the InAppBrowser
+iab.open('local-url.html', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
+
+```
+
+
+
+### Whitelisted Content
+
+```
+var iab = cordova.InAppBrowser;
+
+iab.open('http://whitelisted-url.com'); // loads in the Cordova WebView
+iab.open('http://whitelisted-url.com', '_self'); // loads in the Cordova WebView
+iab.open('http://whitelisted-url.com', '_system'); // loads in the system browser
+iab.open('http://whitelisted-url.com', '_blank'); // loads in the InAppBrowser
+iab.open('http://whitelisted-url.com', 'random_string'); // loads in the InAppBrowser
+
+iab.open('http://whitelisted-url.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
+
+```
+
+### Urls that are not white-listed
+
+```
+var iab = cordova.InAppBrowser;
+
+iab.open('http://url-that-fails-whitelist.com'); // loads in the InAppBrowser
+iab.open('http://url-that-fails-whitelist.com', '_self'); // loads in the InAppBrowser
+iab.open('http://url-that-fails-whitelist.com', '_system'); // loads in the system browser
+iab.open('http://url-that-fails-whitelist.com', '_blank'); // loads in the InAppBrowser
+iab.open('http://url-that-fails-whitelist.com', 'random_string'); // loads in the InAppBrowser
+iab.open('http://url-that-fails-whitelist.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
+
+```
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 3edd9c545..ddd30d56d 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -20,12 +20,411 @@
-->
# Release Notes
+### 1.7.1 (Apr 27, 2017)
+* [CB-12622](https://issues.apache.org/jira/browse/CB-12622) Added **Android 6.0** build badges to `README`
+* [CB-12266](https://issues.apache.org/jira/browse/CB-12266) (browser platform) loadstop event.url is now a string instead of an object, aligning it with the other platforms.
+* [CB-12685](https://issues.apache.org/jira/browse/CB-12685) added `package.json` to tests folder
+* [CB-11248](https://issues.apache.org/jira/browse/CB-11248) `InAppBrowser` no focus on input text fields
+
+### 1.7.0 (Feb 28, 2017)
+* [CB-12366](https://issues.apache.org/jira/browse/CB-12366) **iOS:** Reduce `tmpWindow` level to prevent overlapping statusbar
+* [CB-12364](https://issues.apache.org/jira/browse/CB-12364) **Windows:** `Inappbrowser` inject file manual tests are not working
+* [CB-12353](https://issues.apache.org/jira/browse/CB-12353) Corrected merges usage in `plugin.xml`
+* [CB-12369](https://issues.apache.org/jira/browse/CB-12369) Add plugin typings from `DefinitelyTyped`
+* [CB-12363](https://issues.apache.org/jira/browse/CB-12363) Added build badges for **iOS 9.3** and **iOS 10.0**
+* [CB-9148](https://issues.apache.org/jira/browse/CB-9148) **Android:** Add Support for `input[type=file]` File Chooser
+* [CB-11136](https://issues.apache.org/jira/browse/CB-11136) (ios) Fix `InAppBrowser` when closing with `WKWebView`
+* [CB-10799](https://issues.apache.org/jira/browse/CB-10799) **iOS:** fix toolbar is shown in incorrect position when in-call status bar
+
+### 1.6.1 (Dec 14, 2016)
+* [CB-12237](https://issues.apache.org/jira/browse/CB-12237) - Update version in package.json to correct 1.6.1-dev
+* [CB-12236](https://issues.apache.org/jira/browse/CB-12236) - Fixed RELEASENOTES for cordova-plugin-inappbrowser
+* [CB-12230](https://issues.apache.org/jira/browse/CB-12230) Removed Windows 8.1 build badges
+* [CB-12224](https://issues.apache.org/jira/browse/CB-12224) Incremented plugin version.
+
+### 1.6.0 (Dec 07, 2016)
+* [CB-12224](https://issues.apache.org/jira/browse/CB-12224) Updated version and RELEASENOTES.md for release 1.6.0
+* [CB-7608](https://issues.apache.org/jira/browse/CB-7608) (android) document useWidthViewPort
+* add option useWidthViewPort
+* [CB-12184](https://issues.apache.org/jira/browse/CB-12184) executeScript leads to a null pointer on exception on Android.
+* fix(close button): Set correct content description
+* [CB-9274](https://issues.apache.org/jira/browse/CB-9274) Adds missing methods to InAppBrowser to allow compilation for Amazon FireOS.
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) inAppBrowser for Windows Platform: wrong height of webview with location=yes
+* Increment plugin minor version because of new hide feature
+* removed duplicate hide method in ios source and add jasmine test cases
+* [CB-8467](https://issues.apache.org/jira/browse/CB-8467)
+* [CB-12010](https://issues.apache.org/jira/browse/CB-12010) (android) Catch FileUriExposedException
+* [CB-11955](https://issues.apache.org/jira/browse/CB-11955) Added Initial OSX platform support
+* [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been signed and submitted to secretary@apache.org."
+* [CB-11694](https://issues.apache.org/jira/browse/CB-11694) Android: Set hadwareBackButton value according option in cordova.InAppBrowser.open
+* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version.
+
+### 1.5.1 (Dec 07, 2016)
+* [CB-7608](https://issues.apache.org/jira/browse/CB-7608) (android) document useWidthViewPort
+* add option useWidthViewPort
+* [CB-12184](https://issues.apache.org/jira/browse/CB-12184) executeScript leads to a null pointer on exception on Android.
+* fix(close button): Set correct content description
+* [CB-9274](https://issues.apache.org/jira/browse/CB-9274) Adds missing methods to InAppBrowser to allow compilation for Amazon FireOS.
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) inAppBrowser for Windows Platform: wrong height of webview with location=yes
+* Increment plugin minor version because of new hide feature
+* removed duplicate hide method in ios source and add jasmine test cases
+* [CB-8467](https://issues.apache.org/jira/browse/CB-8467)
+* [CB-12010](https://issues.apache.org/jira/browse/CB-12010) (android) Catch FileUriExposedException
+* [CB-11955](https://issues.apache.org/jira/browse/CB-11955) Added Initial OSX platform support
+* [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been signed and submitted to secretary@apache.org."
+* [CB-11694](https://issues.apache.org/jira/browse/CB-11694) Android: Set hadwareBackButton value according option in cordova.InAppBrowser.open
+* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version.
+* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Updated version and RELEASENOTES.md for release 1.5.0
+* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies
+* Closing invalid pull request: close #28
+* Closing invalid pull request: close #78
+* Add intent scheme to be handled by OS
+* Plugin uses Android Log class and not Cordova LOG class
+* Adding links to guide content and reference content at the top of the readme file Github: close #163
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) inAppBrowser for Browser Platform: wrong height of webview with location=yes
+* Size and position in browser platform
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) inAppBrowser for Windows Platform: wrong height of webview with location=yes
+* [CB-11013](https://issues.apache.org/jira/browse/CB-11013) IAB enabling background play of YouTube videos?
+* [CB-10467](https://issues.apache.org/jira/browse/CB-10467) Hardware back button, while InAppBrowser is opened, closes the app too in addition to closing InAppBrowser
+* [CB-11178](https://issues.apache.org/jira/browse/CB-11178) allow to open other apps on iOS 9
+* Closing stale pull request: close #152
+* fix some calls which used api level 16
+* [CB-5402](https://issues.apache.org/jira/browse/CB-5402) added extra content from wiki page
+* doc: do not use `with` in JS samples
+* Closing stale pull request: close #90
+* [CB-2063](https://issues.apache.org/jira/browse/CB-2063) (ios) Fixed presentation style
+* [CB-11012](https://issues.apache.org/jira/browse/CB-11012) added some clarifications about InAppBrowser object
+* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Set custom inappbrowser user agent for ios
+* Add badges for paramedic builds on Jenkins
+* [CB-11381](https://issues.apache.org/jira/browse/CB-11381) android: Does not pass sonarqube scan
+* Add pull request template.
+* [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine requirements to package.json
+* [CB-110003](https://issues.apache.org/jira/browse/CB-110003) Adding samples to Readme.
+* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to README.md
+* [CB-11091](https://issues.apache.org/jira/browse/CB-11091) Incremented plugin version.
+* Updated version and RELEASENOTES.md for release 1.4.0
+* [CB-7679](https://issues.apache.org/jira/browse/CB-7679) add fix for iOS upload. This closes #139
+* [CB-10944](https://issues.apache.org/jira/browse/CB-10944) : NoSuchMethodError in InAppBrowser plugin
+* [CB-10937](https://issues.apache.org/jira/browse/CB-10937) fix stretched icons
+* [CB-10760](https://issues.apache.org/jira/browse/CB-10760) Fixing README for display on Cordova website
+* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add JSHint for plugins
+* Fixes [CB-10607](https://issues.apache.org/jira/browse/CB-10607)
+* [CB-10557](https://issues.apache.org/jira/browse/CB-10557) Incremented plugin version.
+* [CB-10557](https://issues.apache.org/jira/browse/CB-10557) Updated version and RELEASENOTES.md for release 1.3.0
+* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Set custom inappbrowser user agent for android
+* [CB-10538](https://issues.apache.org/jira/browse/CB-10538) cordova-plugin-inappbrowser timeout issue
+* [CB-10395](https://issues.apache.org/jira/browse/CB-10395) InAppBrowser's WebView not storing cookies reliable on Android
+* chore: edit package.json license to match SPDX id
+* [CB-10305](https://issues.apache.org/jira/browse/CB-10305) Gray bar appears in the wrong place on iOS
+* [CB-7786](https://issues.apache.org/jira/browse/CB-7786) Support mediaPlaybackRequiresUserAction on Android
+* [CB-7500](https://issues.apache.org/jira/browse/CB-7500) executeScript with callback kills/blurs inAppBrowser window on Android
+* [CB-10505](https://issues.apache.org/jira/browse/CB-10505) Incremented plugin version.
+* [CB-10505](https://issues.apache.org/jira/browse/CB-10505) Updated version and RELEASENOTES.md for release 1.2.1
+* handle app store urls in system browser
+* Added missing plugin dependency for manual tests
+* [CB-10451](https://issues.apache.org/jira/browse/CB-10451) InAppBrowser: loadstart event is not triggered on Windows [CB-10452](https://issues.apache.org/jira/browse/CB-10452) InAppBrowser: 'exit' event is not triggered on Windows [CB-10454](https://issues.apache.org/jira/browse/CB-10454) InAppBrowser: 'loaderror' event does not have code and message on Windows [CB-10450](https://issues.apache.org/jira/browse/CB-10450) InAppBrowser: Unable to get property 'canGoBack' of undefined on Windows
+* [CB-6702](https://issues.apache.org/jira/browse/CB-6702) InAppBrowser hangs when opening more than one instance
+* [CB-10456](https://issues.apache.org/jira/browse/CB-10456) InAppBrowser is not closed if I close it programmatically on Android
+* [CB-10441](https://issues.apache.org/jira/browse/CB-10441) Add auto tests for InAppBrowser plugin
+* [CB-10428](https://issues.apache.org/jira/browse/CB-10428) Fix syntax error when browserifying inAppBrowser plugin
+* [CB-10407](https://issues.apache.org/jira/browse/CB-10407) Re-adding onPageStarted to re-add LOAD_START, even though it's in the wrong place
+* [CB-10368](https://issues.apache.org/jira/browse/CB-10368) Incremented plugin version.
+* [CB-10368](https://issues.apache.org/jira/browse/CB-10368) Updated version and RELEASENOTES.md for release 1.2.0
+* [CB-8180](https://issues.apache.org/jira/browse/CB-8180) Changing methods of interception in WebViewClient class
+* Fix lint warnings
+* [CB-10009](https://issues.apache.org/jira/browse/CB-10009) Improve InAppBrowser toolbar look and feel on Windows
+* Using modulemapper
+* Open a new window on the browser platform
+* [CB-10187](https://issues.apache.org/jira/browse/CB-10187) Incremented plugin version.
+* [CB-10187](https://issues.apache.org/jira/browse/CB-10187) Updated version and RELEASENOTES.md for release 1.1.1
+* [CB-9445](https://issues.apache.org/jira/browse/CB-9445) Improves executeScript callbacks on iOS
+* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Incremented plugin version.
+* [CB-10040](https://issues.apache.org/jira/browse/CB-10040) - re-fix: backwards compatible with cordova-ios < 4.0
+* [CB-8534](https://issues.apache.org/jira/browse/CB-8534) Allow plugins to respond to onReceivedHttpAuthRequest. This closes #82
+* [CB-3750](https://issues.apache.org/jira/browse/CB-3750) Fixes spinner on iOS. This closes #89
+* [CB-7696](https://issues.apache.org/jira/browse/CB-7696) Document target=_self behavior for Windows
+* [CB-10040](https://issues.apache.org/jira/browse/CB-10040) - Compile Error in InAppBrowser Plugin for iOS - No known instance method for selector 'URLIsWhitelisted:'
+* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) linked issues in RELEASENOTES.md
+* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated version and RELEASENOTES.md for release 1.1.0
+* removed r prefix from tags
+* weak ref type was wrong
+* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated RELEASENOTES to be newest to oldest
+* Close #91
+* Close #85
+* Invoke webview if using local file
+* Fixed zIndex issue on Windows 8, 8.1 where InAppBrowser opens behind default app.
+* fix async self usage
+* [CB-9150](https://issues.apache.org/jira/browse/CB-9150) Fix InAppBrowser executeScript crash on Windows if no data returned
+* [CB-10008](https://issues.apache.org/jira/browse/CB-10008) Fix InAppBrowser popup layout on Windows
+* InAppBrowser, iOS: Setting setStatusBarStyle to -1 causes CGContextSaveGState.
+* Fix crash on browser window close (https://issues.apache.org/jira/browse/CB-9167)
+* Close #113
+* add JIRA issue tracker link
+* [CB-9799](https://issues.apache.org/jira/browse/CB-9799) Fixed javaDoc errors.. This closes #119
+* Actually fixing the contribute link.
+* Fixing contribute link.
+* [CB-9760](https://issues.apache.org/jira/browse/CB-9760) InAppBrowser: fallback to default window.open behavior on Ripple
+* Close #114
+* [CB-9378](https://issues.apache.org/jira/browse/CB-9378) Fix InAppBrowser not taking whole screen on Windows
+* remove travis-ci
+* [CB-9158](https://issues.apache.org/jira/browse/CB-9158) - InAppBrowser zoomControls are always set to true
+* [CB-9192](https://issues.apache.org/jira/browse/CB-9192) Incremented plugin version.
+* [CB-9202](https://issues.apache.org/jira/browse/CB-9202) updated repo url to github mirror in package.json
+* [CB-9192](https://issues.apache.org/jira/browse/CB-9192) Updated version and RELEASENOTES.md for release 1.0.1
+* [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* fix npm md issue
+* [CB-8858](https://issues.apache.org/jira/browse/CB-8858) Incremented plugin version.
+* [CB-8858](https://issues.apache.org/jira/browse/CB-8858) Updated version in package.json for release 1.0.0
+* Revert "CB-8858 Incremented plugin version."
+* [CB-8858](https://issues.apache.org/jira/browse/CB-8858) Incremented plugin version.
+* [CB-8858](https://issues.apache.org/jira/browse/CB-8858) Updated version and RELEASENOTES.md for release 1.0.0
+* [CB-8746](https://issues.apache.org/jira/browse/CB-8746) gave plugin major version bump
+* [CB-7689](https://issues.apache.org/jira/browse/CB-7689) Adds insertCSS support for windows platform
+* [CB-4930](https://issues.apache.org/jira/browse/CB-4930) - (prefix) InAppBrowser should take into account the status bar
+* [CB-8635](https://issues.apache.org/jira/browse/CB-8635) Improves UX on windows platform
+* [CB-8661](https://issues.apache.org/jira/browse/CB-8661) Return executed script result on Windows
+* [CB-8683](https://issues.apache.org/jira/browse/CB-8683) updated wp and browser specific references of old id to new id
+* [CB-8683](https://issues.apache.org/jira/browse/CB-8683) changed plugin-id to pacakge-name
+* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) properly updated translated docs to use new id
+* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) updated translated docs to use new id
+* Use TRAVIS_BUILD_DIR, install paramedic by npm
+* [CB-8432](https://issues.apache.org/jira/browse/CB-8432) Correct styles for browser wrapper to display it correctly on some pages
+* [CB-8659](https://issues.apache.org/jira/browse/CB-8659) - Update InAppBrowser to support both cordova-ios 4.0.x and 3.x (closes #93)
+* [CB-7961](https://issues.apache.org/jira/browse/CB-7961) Add cordova-plugin-inappbrowser support for browser platform
+* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) Updated Readme
+* Update docs for Android zoom=no option
+* Added option to disable/enable zoom controls
+* updated docs, set hardwareback default to true
+* Add a hardwareback option to allow for the hardware back button to go back.
+* [CB-8570](https://issues.apache.org/jira/browse/CB-8570) Integrate TravisCI
+* [CB-8438](https://issues.apache.org/jira/browse/CB-8438) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* [CB-8538](https://issues.apache.org/jira/browse/CB-8538) Added package.json file
+* Keep external android pages in a single tab. (close #61)
+* [CB-8444](https://issues.apache.org/jira/browse/CB-8444) Add a clobber for `cordova.InAppBrowser.open` (close #80)
+* [CB-8444](https://issues.apache.org/jira/browse/CB-8444) Don't clobber `window.open` - Add new symbol/clobber to access open function (`cordova.InAppBrowser.open`) - Change existing tests to use new symbol (i.e. don't rely on plugin clobber of `window.open`) - Add tests to use `window.open` via manual replace with new symbol - Update docs to deprecate plugin clobber of `window.open`
+* [CB-8429](https://issues.apache.org/jira/browse/CB-8429) Incremented plugin version.
+* [CB-8429](https://issues.apache.org/jira/browse/CB-8429) Updated version and RELEASENOTES.md for release 0.6.0
+* Add missing license header for src/ubuntu/InAppBrowser_escapeScript.js
+* [CB-8270](https://issues.apache.org/jira/browse/CB-8270) Remove usage of `[arr JSONString]`, since it's been renamed to `cdv_JSONString`
+* ubuntu: implement inject* functions
+* ubuntu: port to oxide
+* [CB-7897](https://issues.apache.org/jira/browse/CB-7897) Update to work with whilelist plugins in Cordova 4.x
+* [CB-7897](https://issues.apache.org/jira/browse/CB-7897) Update to work with whilelist plugins in Cordova 4.x
+* [CB-8110](https://issues.apache.org/jira/browse/CB-8110) Incremented plugin version.
+* [CB-8110](https://issues.apache.org/jira/browse/CB-8110) Updated version and RELEASENOTES.md for release 0.5.4
+* Amazon specific changes: Removed reference to closebuttoncaption according to https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-inappbrowser.git;a=commit;h=50a78baf22843b0df96ccb4ca83a45bd9ef3fc39
+* [CB-7784](https://issues.apache.org/jira/browse/CB-7784) Exit event is not fired after InAppBrowser closing
+* [CB-7697](https://issues.apache.org/jira/browse/CB-7697) Add locationBar support to InAppBrowser windows platform version
+* [CB-7690](https://issues.apache.org/jira/browse/CB-7690) InAppBrowser loadstart/loadstop events issues
+* [CB-7695](https://issues.apache.org/jira/browse/CB-7695) Fix InAppBrowser injectScriptFile for Windows 8.1 / Windows Phone 8.1
+* [CB-7692](https://issues.apache.org/jira/browse/CB-7692) InAppBrowser local url opening bug in 8.1
+* [CB-7688](https://issues.apache.org/jira/browse/CB-7688) Alert is not supported in InAppBrowser on Windows platform
+* [CB-7977](https://issues.apache.org/jira/browse/CB-7977) Mention deviceready in plugin docs
+* Dropping trailing whitespace
+* [CB-7876](https://issues.apache.org/jira/browse/CB-7876) change test target to avoid undesired redirects
+* [CB-7712](https://issues.apache.org/jira/browse/CB-7712) remove references to closebuttoncaption
+* [CB-7850](https://issues.apache.org/jira/browse/CB-7850) clarify role of whitelist
+* [CB-7720](https://issues.apache.org/jira/browse/CB-7720) check if event is null since OK string from success callback was removed
+* [CB-7700](https://issues.apache.org/jira/browse/CB-7700) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* [CB-7471](https://issues.apache.org/jira/browse/CB-7471) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* Incremented plugin version.
+* Updated version and RELEASENOTES.md for release 0.5.3
+* Amazon Specific changes: Added logs and corrected indentation according to 81161ebe668a14f87e1ef4b57f2d300a609b9a8b
+* Windows implementation fixes and improvements
+* zIndex fixed
+* renamed InAppBrowser back to inappbrowser for case sensitive operating systems
+* Clean plugin.xml
+* Update french translation
+* Update doc to add Windows 8
+* Update windows proxy to be both compatible with windows 8 and 8.1
+* Rename windows81 by windows8 in src directory
+* Append Windows 8.1 platform configuration in plugin.xml
+* Append Windows 8.1 proxy using x-ms-webview
+* [CB-7571](https://issues.apache.org/jira/browse/CB-7571) Bump version of nested plugin to match parent plugin
+* [CB-7571](https://issues.apache.org/jira/browse/CB-7571) Incremented plugin version.
+* [CB-7571](https://issues.apache.org/jira/browse/CB-7571) Updated version and RELEASENOTES.md for release 0.5.2
+* [CB-7471](https://issues.apache.org/jira/browse/CB-7471) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* [CB-7490](https://issues.apache.org/jira/browse/CB-7490) Fixes InAppBrowser manual tests crash on windows platform
+* [CB-7249](https://issues.apache.org/jira/browse/CB-7249) cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* [CB-7424](https://issues.apache.org/jira/browse/CB-7424) - Wrong docs: anchor tags are not supported by the InAppBrowser
+* [CB-7133](https://issues.apache.org/jira/browse/CB-7133) clarify that anchor1 doesn't exist
+* [CB-7133](https://issues.apache.org/jira/browse/CB-7133) more fixup of tests on Android
+* [CB-7133](https://issues.apache.org/jira/browse/CB-7133) fix up the tests for Android
+* Add just a bit more logging
+* [CB-7133](https://issues.apache.org/jira/browse/CB-7133) port inappbrowser to plugin-test-framework
+* phonegap events supported for _blank target
+* inappbrowser _blank target position is fixed
+* amazon-fireos related changes.
+* [CB-7244](https://issues.apache.org/jira/browse/CB-7244) Incremented plugin version.
+* [CB-7244](https://issues.apache.org/jira/browse/CB-7244) Updated version and RELEASENOTES.md for release 0.5.1
+* ubuntu: support qt 5.2
+* CB-7249cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* update InAppBrowserProxy.js
+* app needs to be privileged
+* CB-6127lisa7cordova-plugin-consolecordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
+* [CB-6769](https://issues.apache.org/jira/browse/CB-6769) ios: Fix statusbar color reset wasn't working on iOS7+
+* [CB-6877](https://issues.apache.org/jira/browse/CB-6877) Incremented plugin version.
+* [CB-6877](https://issues.apache.org/jira/browse/CB-6877) Updated version and RELEASENOTES.md for release 0.5.0
+* [CB-6127](https://issues.apache.org/jira/browse/CB-6127) Spanish and rench Translations added. Github close #23
+* Clean up whitespace (mainly due to no newline at eof warning)
+* after code review
+* default parameter added
+* doc updated
+* console.log removed
+* back/forward buttons added, iframe has no border
+* not forcing the look of the inAppBrowserWrap and buttons
+* Adding permission info
+* [CB-6806](https://issues.apache.org/jira/browse/CB-6806) Add license
+* documentation translation: cordova-plugin-inappbrowser
+* Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser
+* Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser
+* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md
+* Add necessary capability so the plugin works on its own
+* [CB-6474](https://issues.apache.org/jira/browse/CB-6474) InAppBrowser. Add data urls support to WP8
+* [CB-6482](https://issues.apache.org/jira/browse/CB-6482) InAppBrowser calls incorrect callback on WP8
+* Fixed use of iOS 6 deprecated methods
+* [CB-6360](https://issues.apache.org/jira/browse/CB-6360) - improvement: feature detection instead of iOS version detection
+* [CB-5649](https://issues.apache.org/jira/browse/CB-5649) - InAppBrowser overrides App's orientation
+* [CB-6452](https://issues.apache.org/jira/browse/CB-6452) Incremented plugin version on dev branch.
+* [CB-6452](https://issues.apache.org/jira/browse/CB-6452) Updated version and RELEASENOTES.md for release 0.4.0
+* [CB-6460](https://issues.apache.org/jira/browse/CB-6460) Update license headers
+* [CB-6360](https://issues.apache.org/jira/browse/CB-6360) Fix for crash on iOS < 6.0 (closes #37)
+* [CB-3324](https://issues.apache.org/jira/browse/CB-3324) Add support for back-button inappbrowser [WP8] if there is no history -> InAppBrowser is closed
+* await async calls, resolve warnings
+* Make InAppBrowser work with embedded files, using system behavior
+* [CB-6402](https://issues.apache.org/jira/browse/CB-6402) [WP8] pass empty string instead of null for [optional] windowFeatures string
+* [CB-6422](https://issues.apache.org/jira/browse/CB-6422) [windows8] use cordova/exec/proxy
+* [CB-3617](https://issues.apache.org/jira/browse/CB-3617) Document clearcache and clearsessioncache for ios
+* [CB-6389](https://issues.apache.org/jira/browse/CB-6389) [CB-3617](https://issues.apache.org/jira/browse/CB-3617) Add clearcache and clearsessioncache options to iOS (like Android)
+* refactoring fixed
+* [CB-6396](https://issues.apache.org/jira/browse/CB-6396) [Firefox OS] Adding basic support
+* Doc update: event name and example param (closes #31)
+* [CB-6253](https://issues.apache.org/jira/browse/CB-6253) Add Network Capability to WMAppManifest.xml
+* [CB-6212](https://issues.apache.org/jira/browse/CB-6212) iOS: fix warnings compiled under arm64 64-bit
+* [CB-6218](https://issues.apache.org/jira/browse/CB-6218) Update docs for BB10
+* Tweak RELEASENOTES.md (missed a bug fix in last release)
+* Incremented plugin version on dev branch.
+* [CB-6218](https://issues.apache.org/jira/browse/CB-6218) Update docs for BB10
+* Updated version and RELEASENOTES.md for release 0.3.3
+* [CB-6172](https://issues.apache.org/jira/browse/CB-6172) Fix inappbrowser install failure on case-sensitive filesystems.
+* [CB-5534](https://issues.apache.org/jira/browse/CB-5534) Updating the plugin.xml with the new Dialog class
+* fix for [CB-5534](https://issues.apache.org/jira/browse/CB-5534)
+* Add NOTICE file
+* [CB-6114](https://issues.apache.org/jira/browse/CB-6114) Incremented plugin version on dev branch.
+* Add NOTICE file
+* [CB-6114](https://issues.apache.org/jira/browse/CB-6114) Updated version and RELEASENOTES.md for release 0.3.2
+* Validate that callbackId is correctly formed
+* [CB-6035](https://issues.apache.org/jira/browse/CB-6035) - Move js-module so it is not loaded on unsupported platforms
+* [CB-5980](https://issues.apache.org/jira/browse/CB-5980) Incremented plugin version on dev branch.
+* [CB-5980](https://issues.apache.org/jira/browse/CB-5980) Updated version and RELEASENOTES.md for release 0.3.1
+* Removed some iOS6 Deprecations
+* Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser
+* Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser
+* [CB-5980](https://issues.apache.org/jira/browse/CB-5980) Updated version and RELEASENOTES.md for release 0.3.1
+* Add missing import for previous commit
+* [CB-5756](https://issues.apache.org/jira/browse/CB-5756) Android: Use WebView.evaluateJavascript for script injection on Android 4.4+
+* Didn't test on ICS or lower, getDrawable isn't supported until Jellybean
+* WTF? ubuntu got automerged twice
+* add ubuntu platform
+* Adding CC-A-2.5 Notice for Assets, modifying plugins to use resources
+* Adding the buttons
+* Adding drawables to the inAppBrowser. This doesn't look quite right, but it's a HUGE improvement over the previous settings
+* [CB-5756](https://issues.apache.org/jira/browse/CB-5756) Add missing import
+* [CB-5756](https://issues.apache.org/jira/browse/CB-5756) Android: Use WebView.evaluateJavascript for script injection on Android 4.4+
+* Delete stale test/ directory
+* Remove _alive from InAppBrowser.js since it didn't catch the case where the browser is closed by the user.
+* [CB-5733](https://issues.apache.org/jira/browse/CB-5733) Fix IAB.close() not working if called before show() animation is done
+* [CB-5719](https://issues.apache.org/jira/browse/CB-5719) Incremented plugin version on dev branch.
+* [CB-5719](https://issues.apache.org/jira/browse/CB-5719) Updated version and RELEASENOTES.md for release 0.3.0
+* [CB-5592](https://issues.apache.org/jira/browse/CB-5592) Add a comment explaining why we set MIME only for file:
+* [CB-5592](https://issues.apache.org/jira/browse/CB-5592) Android - Add MIME type to Intent when opening file:/// URLs
+* [CB-5658](https://issues.apache.org/jira/browse/CB-5658) Update license comment formatting of doc/index.md
+* [CB-5658](https://issues.apache.org/jira/browse/CB-5658) Add doc.index.md for InAppBrowser plugin
+* [CB-5658](https://issues.apache.org/jira/browse/CB-5658) Delete stale snapshot of plugin docs
+* [CB-5594](https://issues.apache.org/jira/browse/CB-5594) Add disallowoverscroll option.
+* [CB-5595](https://issues.apache.org/jira/browse/CB-5595) Rename "toolbarbarpostion" -> "toolbarposition"
+* [CB-5595](https://issues.apache.org/jira/browse/CB-5595) Fixed the positioning and autoresizing for certain rotation scenarios.
+* [CB-5595](https://issues.apache.org/jira/browse/CB-5595) Add toolbarposition=top option.
+* Apply [CB-5193](https://issues.apache.org/jira/browse/CB-5193) to InAppBrowser
+* [CB-5593](https://issues.apache.org/jira/browse/CB-5593) iOS: Make InAppBrowser localizable
+* [CB-5591](https://issues.apache.org/jira/browse/CB-5591) Change window.escape to encodeURIComponent
+* [CB-5565](https://issues.apache.org/jira/browse/CB-5565) Incremented plugin version on dev branch.
+* [CB-5565](https://issues.apache.org/jira/browse/CB-5565) Updated version and RELEASENOTES.md for release 0.2.5
+* Remove merge conflict tag
+* [CB-4724](https://issues.apache.org/jira/browse/CB-4724) fixed UriFormatException
+* add ubuntu platform
+* [CB-3420](https://issues.apache.org/jira/browse/CB-3420) WP feature hidden=yes implemented
+* Added amazon-fireos platform. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos'
+* [CB-5188](https://issues.apache.org/jira/browse/CB-5188)
+* [CB-5188](https://issues.apache.org/jira/browse/CB-5188) Updated version and RELEASENOTES.md for release 0.2.4
+* [CB-5128](https://issues.apache.org/jira/browse/CB-5128) added repo + issue tag to plugin.xml for inappbrowser plugin
+* [CB-4995](https://issues.apache.org/jira/browse/CB-4995) Fix crash when WebView is quickly opened then closed.
+* [CB-4930](https://issues.apache.org/jira/browse/CB-4930) - iOS - InAppBrowser should take into account the status bar
+* [CB-5010](https://issues.apache.org/jira/browse/CB-5010) Incremented plugin version on dev branch.
+* [CB-5010](https://issues.apache.org/jira/browse/CB-5010) Updated version and RELEASENOTES.md for release 0.2.3
+* [CB-4858](https://issues.apache.org/jira/browse/CB-4858) - Run IAB methods on the UI thread.
+* [CB-4858](https://issues.apache.org/jira/browse/CB-4858) Convert relative URLs to absolute URLs in JS
+* [CB-3747](https://issues.apache.org/jira/browse/CB-3747) Fix back button having different dismiss logic from the close button.
+* [CB-5021](https://issues.apache.org/jira/browse/CB-5021) Expose closeDialog() as a public function and make it safe to call multiple times.
+* [CB-5021](https://issues.apache.org/jira/browse/CB-5021) Make it safe to call close() multiple times
+* [CB-5010](https://issues.apache.org/jira/browse/CB-5010) Updated version and RELEASENOTES.md for release 0.2.3
+* [CB-4915](https://issues.apache.org/jira/browse/CB-4915) Incremented plugin version on dev branch.
+* [CB-4926](https://issues.apache.org/jira/browse/CB-4926) Fixes inappbrowser plugin loading for windows8
+* [CB-4915](https://issues.apache.org/jira/browse/CB-4915) Updated version and RELEASENOTES.md for release 0.2.2
+* [CB-4889](https://issues.apache.org/jira/browse/CB-4889) bumping&resetting version
+* [CB-4788](https://issues.apache.org/jira/browse/CB-4788) Modified the onJsPrompt to warn against Cordova calls
+* [windows8] commandProxy was moved
+* [CB-4788](https://issues.apache.org/jira/browse/CB-4788) Modified the onJsPrompt to warn against Cordova calls
+* [windows8] commandProxy was moved
+* [CB-4889](https://issues.apache.org/jira/browse/CB-4889) renaming core references
+* [CB-4889](https://issues.apache.org/jira/browse/CB-4889) renaming org.apache.cordova.core.inappbrowser to org.apache.cordova.inappbrowser
+* CB-4864, [CB-4865](https://issues.apache.org/jira/browse/CB-4865) Minor improvements to InAppBrowser
+* Rename CHANGELOG.md -> RELEASENOTES.md
+* [CB-4792](https://issues.apache.org/jira/browse/CB-4792) Added keepCallback to the show function.
+* [CB-4752](https://issues.apache.org/jira/browse/CB-4752) Incremented plugin version on dev branch.
+* Add empty CHANGELOG.md
+* [CB-4586](https://issues.apache.org/jira/browse/CB-4586) Making loadUrl run on the UI thread for close dialog to stop the WebView error
+* [Windows8] add support for Windows 8 ( limited )
+* [CB-3616](https://issues.apache.org/jira/browse/CB-3616) Change option name to "clearcache" to match original proposal
+* add "clearallcache" and "clearsessioncache" option to InAppbrowser
+* [CB-4595](https://issues.apache.org/jira/browse/CB-4595) updated version
+* [CB-4417](https://issues.apache.org/jira/browse/CB-4417) Move cordova-plugin-inappbrowser to its own Java package.
+* updated Readme, namespace and name tag
+* [plugin.xml] standardizing license + meta
+* [license] adding apache license file
+* [CB-4399](https://issues.apache.org/jira/browse/CB-4399) removed blackberry entry in plugin xml. Installation of plugin interferes with natively supported childbrowser functionality. To support additional inappbrowser features, see [CB-4467.](https://issues.apache.org/jira/browse/CB-4467.)
+* updating plugin.xml with registry data
+* [CB-4368](https://issues.apache.org/jira/browse/CB-4368) Explicit CoreGraphics.framework dependency should be specified for some core plugins
+
+### 1.5.0 (Sep 08, 2016)
+* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies
+* Add intent scheme to be handled by OS
+* Plugin uses `Android Log class` and not `Cordova LOG class`
+* Adding links to guide content and reference content at the top of the readme file Github: close #163
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) **Browser**: wrong height of webview with `location=yes`
+* Size and position in browser platform
+* [CB-10973](https://issues.apache.org/jira/browse/CB-10973) **Windows**: wrong height of webview with `location=yes`
+* [CB-11013](https://issues.apache.org/jira/browse/CB-11013) IAB enabling background play of YouTube videos?
+* [CB-10467](https://issues.apache.org/jira/browse/CB-10467) Hardware back button, while `InAppBrowser` is opened, closes the app too in addition to closing `InAppBrowser`
+* [CB-11178](https://issues.apache.org/jira/browse/CB-11178) allow to open other apps on **iOS 9**
+* fix some calls which used api level 16
+* [CB-5402](https://issues.apache.org/jira/browse/CB-5402) added extra content from wiki page
+* [CB-2063](https://issues.apache.org/jira/browse/CB-2063) (**ios**) Fixed presentation style
+* [CB-11012](https://issues.apache.org/jira/browse/CB-11012) added some clarifications about `InAppBrowser` object
+* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Set custom `inappbrowser` user agent for **ios**
+* Add badges for paramedic builds on Jenkins
+* [CB-11381](https://issues.apache.org/jira/browse/CB-11381) android: Does not pass sonarqube scan
+* Add pull request template.
+* [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine requirements to `package.json`
+* [CB-110003](https://issues.apache.org/jira/browse/CB-110003) Adding samples to Readme.
+* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to README.md
+
### 1.4.0 (Apr 15, 2016)
-* CB-7679 add fix for **iOS** upload.
-* CB-10944 `NoSuchMethodError` in `InAppBrowser` plugin
-* CB-10937 fix stretched icons
-* CB-10760 Fixing README for display on Cordova website
-* CB-10636 Add `JSHint` for plugins
+* [CB-7679](https://issues.apache.org/jira/browse/CB-7679) add fix for **iOS** upload.
+* [CB-10944](https://issues.apache.org/jira/browse/CB-10944) `NoSuchMethodError` in `InAppBrowser` plugin
+* [CB-10937](https://issues.apache.org/jira/browse/CB-10937) fix stretched icons
+* [CB-10760](https://issues.apache.org/jira/browse/CB-10760) Fixing README for display on Cordova website
+* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add `JSHint` for plugins
### 1.3.0 (Feb 09, 2016)
* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Set custom inappbrowser user agent for android
@@ -49,19 +448,19 @@
* [CB-10441](https://issues.apache.org/jira/browse/CB-10441) Add auto tests for InAppBrowser plugin
### 1.2.0 (Jan 15, 2016)
-* CB-8180: Changing methods of interception in `WebViewClient` class
-* CB-10009 Improve `InAppBrowser` toolbar look and feel on **Windows**
+* [CB-8180](https://issues.apache.org/jira/browse/CB-8180) Changing methods of interception in `WebViewClient` class
+* [CB-10009](https://issues.apache.org/jira/browse/CB-10009) Improve `InAppBrowser` toolbar look and feel on **Windows**
* Open a new window on the **Browser** platform
### 1.1.1 (Dec 10, 2015)
-* CB-9445 Improves executeScript callbacks on iOS
-* CB-10035 Incremented plugin version.
-* CB-10040 - re-fix: backwards compatible with cordova-ios < 4.0
-* CB-8534: Allow plugins to respond to onReceivedHttpAuthRequest. This closes #82
-* CB-3750: Fixes spinner on iOS. This closes #89
-* CB-7696 Document target=_self behavior for Windows
-* CB-10040 - Compile Error in InAppBrowser Plugin for iOS - No known instance method for selector 'URLIsWhitelisted:'
+* [CB-9445](https://issues.apache.org/jira/browse/CB-9445) Improves executeScript callbacks on iOS
+* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Incremented plugin version.
+* [CB-10040](https://issues.apache.org/jira/browse/CB-10040) - re-fix: backwards compatible with cordova-ios < 4.0
+* [CB-8534](https://issues.apache.org/jira/browse/CB-8534) Allow plugins to respond to onReceivedHttpAuthRequest. This closes #82
+* [CB-3750](https://issues.apache.org/jira/browse/CB-3750) Fixes spinner on iOS. This closes #89
+* [CB-7696](https://issues.apache.org/jira/browse/CB-7696) Document target=_self behavior for Windows
+* [CB-10040](https://issues.apache.org/jira/browse/CB-10040) - Compile Error in InAppBrowser Plugin for iOS - No known instance method for selector 'URLIsWhitelisted:'
### 1.1.0 (Nov 18, 2015)
* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest
diff --git a/package.json b/package.json
index 2dd46c688..a7e0ef0fe 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,8 @@
{
"name": "cordova-plugin-inappbrowser",
- "version": "1.4.0",
+ "version": "1.7.2-dev",
"description": "Cordova InAppBrowser Plugin",
+ "types": "./types/index.d.ts",
"cordova": {
"id": "cordova-plugin-inappbrowser",
"platforms": [
@@ -9,6 +10,7 @@
"amazon-fireos",
"ubuntu",
"ios",
+ "osx",
"wp7",
"wp8",
"windows8",
@@ -20,6 +22,9 @@
"type": "git",
"url": "https://github.com/apache/cordova-plugin-inappbrowser"
},
+ "bugs": {
+ "url": "https://issues.apache.org/jira/browse/CB"
+ },
"keywords": [
"cordova",
"in",
@@ -31,6 +36,7 @@
"cordova-amazon-fireos",
"cordova-ubuntu",
"cordova-ios",
+ "cordova-osx",
"cordova-wp7",
"cordova-wp8",
"cordova-windows8",
@@ -41,12 +47,16 @@
"test": "npm run jshint",
"jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
},
- "engines": [
- {
- "name": "cordova",
- "version": ">=3.1.0"
+ "engines": {
+ "cordovaDependencies": {
+ "0.2.3": {
+ "cordova": ">=3.1.0"
+ },
+ "2.0.0": {
+ "cordova": ">100"
+ }
}
- ],
+ },
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"devDependencies": {
diff --git a/plugin.xml b/plugin.xml
index 1e393f929..5329fdfda 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -20,7 +20,7 @@
+ version="1.7.2-dev">
InAppBrowserCordova InAppBrowser Plugin
@@ -40,7 +40,7 @@
-
+
@@ -74,7 +74,7 @@
-
+
@@ -82,24 +82,24 @@
-
+
-
+
-
+
-
+
@@ -118,19 +118,35 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -159,7 +175,7 @@
-
+
@@ -195,11 +211,11 @@
-
+
-
+
@@ -210,7 +226,7 @@
-
+
@@ -221,7 +237,7 @@
-
+
diff --git a/src/amazon/InAppBrowser.java b/src/amazon/InAppBrowser.java
index 0263ea2ca..c5d6f6611 100644
--- a/src/amazon/InAppBrowser.java
+++ b/src/amazon/InAppBrowser.java
@@ -84,6 +84,7 @@ public class InAppBrowser extends CordovaPlugin {
private static final String LOAD_ERROR_EVENT = "loaderror";
private static final String CLEAR_ALL_CACHE = "clearcache";
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
+ private static final String HARDWARE_BACK_BUTTON = "hardwareback";
private InAppBrowserDialog dialog;
private AmazonWebView inAppWebView;
@@ -94,6 +95,7 @@ public class InAppBrowser extends CordovaPlugin {
private boolean openWindowHidden = false;
private boolean clearAllCache= false;
private boolean clearSessionCache=false;
+ private boolean hadwareBackButton=true;
/**
* Executes the request and returns PluginResult.
@@ -212,6 +214,17 @@ public void run() {
pluginResult.setKeepCallback(true);
this.callbackContext.sendPluginResult(pluginResult);
}
+ else if (action.equals("hide")) {
+ this.cordova.getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ dialog.hide();
+ }
+ });
+ PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
+ pluginResult.setKeepCallback(true);
+ this.callbackContext.sendPluginResult(pluginResult);
+ }
else {
return false;
}
@@ -367,7 +380,7 @@ public void onPageFinished(AmazonWebView view, String url) {
/**
* Checks to see if it is possible to go back one page in history, then does so.
*/
- private void goBack() {
+ public void goBack() {
this.cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
if (InAppBrowser.this.inAppWebView.canGoBack()) {
@@ -377,6 +390,22 @@ public void run() {
});
}
+ /**
+ * Can the web browser go back?
+ * @return boolean
+ */
+ public boolean canGoBack() {
+ return this.inAppWebView.canGoBack();
+ }
+
+ /**
+ * Has the user set the hardware back button to go back
+ * @return boolean
+ */
+ public boolean hardwareBack() {
+ return hadwareBackButton;
+ }
+
/**
* Checks to see if it is possible to go forward one page in history, then does so.
*/
@@ -458,6 +487,10 @@ public String showWebPage(final String url, HashMap features) {
if (hidden != null) {
openWindowHidden = hidden.booleanValue();
}
+ Boolean hardwareBack = features.get(HARDWARE_BACK_BUTTON);
+ if (hardwareBack != null) {
+ hadwareBackButton = hardwareBack.booleanValue();
+ }
Boolean cache = features.get(CLEAR_ALL_CACHE);
if (cache != null) {
clearAllCache = cache.booleanValue();
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index f105a62c6..fefbcece1 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -29,7 +29,6 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.os.Build;
import android.os.Bundle;
import android.text.InputType;
-import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -42,6 +41,8 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.HttpAuthHandler;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -87,6 +88,9 @@ public class InAppBrowser extends CordovaPlugin {
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
private static final String HARDWARE_BACK_BUTTON = "hardwareback";
private static final String MEDIA_PLAYBACK_REQUIRES_USER_ACTION = "mediaPlaybackRequiresUserAction";
+ private static final String SHOULD_PAUSE = "shouldPauseOnSuspend";
+ private static final Boolean DEFAULT_HARDWARE_BACK = true;
+ private static final String USER_WIDE_VIEW_PORT = "useWideViewPort";
private InAppBrowserDialog dialog;
private WebView inAppWebView;
@@ -99,6 +103,12 @@ public class InAppBrowser extends CordovaPlugin {
private boolean clearSessionCache = false;
private boolean hadwareBackButton = true;
private boolean mediaPlaybackRequiresUserGesture = false;
+ private boolean shouldPauseInAppBrowser = false;
+ private boolean useWideViewPort = true;
+ private ValueCallback mUploadCallback;
+ private ValueCallback mUploadCallbackLollipop;
+ private final static int FILECHOOSER_REQUESTCODE = 1;
+ private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2;
/**
* Executes the request and returns PluginResult.
@@ -119,7 +129,7 @@ public boolean execute(String action, CordovaArgs args, final CallbackContext ca
final String target = t;
final HashMap features = parseFeature(args.optString(2));
- Log.d(LOG_TAG, "target = " + target);
+ LOG.d(LOG_TAG, "target = " + target);
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
@@ -127,7 +137,7 @@ public void run() {
String result = "";
// SELF
if (SELF.equals(target)) {
- Log.d(LOG_TAG, "in self");
+ LOG.d(LOG_TAG, "in self");
/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
* Previously the Config class had a static method, isUrlWhitelisted(). That
* responsibility has been moved to the plugins, with an aggregating method in
@@ -142,8 +152,11 @@ public void run() {
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
} catch (NoSuchMethodException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}
if (shouldAllowNavigation == null) {
@@ -153,20 +166,23 @@ public void run() {
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
} catch (NoSuchMethodException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}
// load in webview
if (Boolean.TRUE.equals(shouldAllowNavigation)) {
- Log.d(LOG_TAG, "loading in webview");
+ LOG.d(LOG_TAG, "loading in webview");
webView.loadUrl(url);
}
//Load the dialer
else if (url.startsWith(WebView.SCHEME_TEL))
{
try {
- Log.d(LOG_TAG, "loading in dialer");
+ LOG.d(LOG_TAG, "loading in dialer");
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse(url));
cordova.getActivity().startActivity(intent);
@@ -176,18 +192,18 @@ else if (url.startsWith(WebView.SCHEME_TEL))
}
// load in InAppBrowser
else {
- Log.d(LOG_TAG, "loading in InAppBrowser");
+ LOG.d(LOG_TAG, "loading in InAppBrowser");
result = showWebPage(url, features);
}
}
// SYSTEM
else if (SYSTEM.equals(target)) {
- Log.d(LOG_TAG, "in system");
+ LOG.d(LOG_TAG, "in system");
result = openExternal(url);
}
// BLANK - or anything else
else {
- Log.d(LOG_TAG, "in blank");
+ LOG.d(LOG_TAG, "in blank");
result = showWebPage(url, features);
}
@@ -245,6 +261,17 @@ public void run() {
pluginResult.setKeepCallback(true);
this.callbackContext.sendPluginResult(pluginResult);
}
+ else if (action.equals("hide")) {
+ this.cordova.getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ dialog.hide();
+ }
+ });
+ PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
+ pluginResult.setKeepCallback(true);
+ this.callbackContext.sendPluginResult(pluginResult);
+ }
else {
return false;
}
@@ -259,6 +286,26 @@ public void onReset() {
closeDialog();
}
+ /**
+ * Called when the system is about to start resuming a previous activity.
+ */
+ @Override
+ public void onPause(boolean multitasking) {
+ if (shouldPauseInAppBrowser) {
+ inAppWebView.onPause();
+ }
+ }
+
+ /**
+ * Called when the activity will start interacting with the user.
+ */
+ @Override
+ public void onResume(boolean multitasking) {
+ if (shouldPauseInAppBrowser) {
+ inAppWebView.onResume();
+ }
+ }
+
/**
* Called by AccelBroker when listener is to be shut down.
* Stop listener.
@@ -284,29 +331,33 @@ public void onDestroy() {
* which should be executed directly.
*/
private void injectDeferredObject(String source, String jsWrapper) {
- String scriptToInject;
- if (jsWrapper != null) {
- org.json.JSONArray jsonEsc = new org.json.JSONArray();
- jsonEsc.put(source);
- String jsonRepr = jsonEsc.toString();
- String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
- scriptToInject = String.format(jsWrapper, jsonSourceString);
+ if (inAppWebView!=null) {
+ String scriptToInject;
+ if (jsWrapper != null) {
+ org.json.JSONArray jsonEsc = new org.json.JSONArray();
+ jsonEsc.put(source);
+ String jsonRepr = jsonEsc.toString();
+ String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
+ scriptToInject = String.format(jsWrapper, jsonSourceString);
+ } else {
+ scriptToInject = source;
+ }
+ final String finalScriptToInject = scriptToInject;
+ this.cordova.getActivity().runOnUiThread(new Runnable() {
+ @SuppressLint("NewApi")
+ @Override
+ public void run() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ // This action will have the side-effect of blurring the currently focused element
+ inAppWebView.loadUrl("javascript:" + finalScriptToInject);
+ } else {
+ inAppWebView.evaluateJavascript(finalScriptToInject, null);
+ }
+ }
+ });
} else {
- scriptToInject = source;
+ LOG.d(LOG_TAG, "Can't inject code into the system browser");
}
- final String finalScriptToInject = scriptToInject;
- this.cordova.getActivity().runOnUiThread(new Runnable() {
- @SuppressLint("NewApi")
- @Override
- public void run() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
- // This action will have the side-effect of blurring the currently focused element
- inAppWebView.loadUrl("javascript:" + finalScriptToInject);
- } else {
- inAppWebView.evaluateJavascript(finalScriptToInject, null);
- }
- }
- });
}
/**
@@ -355,8 +406,9 @@ public String openExternal(String url) {
intent.putExtra(Browser.EXTRA_APPLICATION_ID, cordova.getActivity().getPackageName());
this.cordova.getActivity().startActivity(intent);
return "";
- } catch (android.content.ActivityNotFoundException e) {
- Log.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
+ // not catching FileUriExposedException explicitly because buildtools<24 doesn't know about it
+ } catch (java.lang.RuntimeException e) {
+ LOG.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
return e.toString();
}
}
@@ -394,7 +446,7 @@ public void onPageFinished(WebView view, String url) {
obj.put("type", EXIT_EVENT);
sendUpdate(obj, false);
} catch (JSONException ex) {
- Log.d(LOG_TAG, "Should never happen");
+ LOG.d(LOG_TAG, "Should never happen");
}
}
});
@@ -494,6 +546,8 @@ public String showWebPage(final String url, HashMap features) {
Boolean hardwareBack = features.get(HARDWARE_BACK_BUTTON);
if (hardwareBack != null) {
hadwareBackButton = hardwareBack.booleanValue();
+ } else {
+ hadwareBackButton = DEFAULT_HARDWARE_BACK;
}
Boolean mediaPlayback = features.get(MEDIA_PLAYBACK_REQUIRES_USER_ACTION);
if (mediaPlayback != null) {
@@ -508,6 +562,14 @@ public String showWebPage(final String url, HashMap features) {
clearSessionCache = cache.booleanValue();
}
}
+ Boolean shouldPause = features.get(SHOULD_PAUSE);
+ if (shouldPause != null) {
+ shouldPauseInAppBrowser = shouldPause.booleanValue();
+ }
+ Boolean wideViewPort = features.get(USER_WIDE_VIEW_PORT);
+ if (wideViewPort != null ) {
+ useWideViewPort = wideViewPort.booleanValue();
+ }
}
final CordovaWebView thatWebView = this.webView;
@@ -573,11 +635,15 @@ public void run() {
Resources activityRes = cordova.getActivity().getResources();
int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
Drawable backIcon = activityRes.getDrawable(backResId);
- back.setBackground(null);
+ if (Build.VERSION.SDK_INT >= 16)
+ back.setBackground(null);
+ else
+ back.setBackgroundDrawable(null);
back.setImageDrawable(backIcon);
back.setScaleType(ImageView.ScaleType.FIT_CENTER);
back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
- back.getAdjustViewBounds();
+ if (Build.VERSION.SDK_INT >= 16)
+ back.getAdjustViewBounds();
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -594,11 +660,15 @@ public void onClick(View v) {
forward.setId(Integer.valueOf(3));
int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
Drawable fwdIcon = activityRes.getDrawable(fwdResId);
- forward.setBackground(null);
+ if (Build.VERSION.SDK_INT >= 16)
+ forward.setBackground(null);
+ else
+ forward.setBackgroundDrawable(null);
forward.setImageDrawable(fwdIcon);
forward.setScaleType(ImageView.ScaleType.FIT_CENTER);
forward.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
- forward.getAdjustViewBounds();
+ if (Build.VERSION.SDK_INT >= 16)
+ forward.getAdjustViewBounds();
forward.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -634,15 +704,19 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
close.setLayoutParams(closeLayoutParams);
- forward.setContentDescription("Close Button");
+ close.setContentDescription("Close Button");
close.setId(Integer.valueOf(5));
int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName());
Drawable closeIcon = activityRes.getDrawable(closeResId);
- close.setBackground(null);
+ if (Build.VERSION.SDK_INT >= 16)
+ close.setBackground(null);
+ else
+ close.setBackgroundDrawable(null);
close.setImageDrawable(closeIcon);
close.setScaleType(ImageView.ScaleType.FIT_CENTER);
back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
- close.getAdjustViewBounds();
+ if (Build.VERSION.SDK_INT >= 16)
+ close.getAdjustViewBounds();
close.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -654,7 +728,49 @@ public void onClick(View v) {
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
inAppWebView.setId(Integer.valueOf(6));
- inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
+ // File Chooser Implemented ChromeClient
+ inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
+ // For Android 5.0+
+ public boolean onShowFileChooser (WebView webView, ValueCallback filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
+ {
+ LOG.d(LOG_TAG, "File Chooser 5.0+");
+ // If callback exists, finish it.
+ if(mUploadCallbackLollipop != null) {
+ mUploadCallbackLollipop.onReceiveValue(null);
+ }
+ mUploadCallbackLollipop = filePathCallback;
+
+ // Create File Chooser Intent
+ Intent content = new Intent(Intent.ACTION_GET_CONTENT);
+ content.addCategory(Intent.CATEGORY_OPENABLE);
+ content.setType("*/*");
+
+ // Run cordova startActivityForResult
+ cordova.startActivityForResult(InAppBrowser.this, Intent.createChooser(content, "Select File"), FILECHOOSER_REQUESTCODE_LOLLIPOP);
+ return true;
+ }
+
+ // For Android 4.1+
+ public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture)
+ {
+ LOG.d(LOG_TAG, "File Chooser 4.1+");
+ // Call file chooser for Android 3.0+
+ openFileChooser(uploadMsg, acceptType);
+ }
+
+ // For Android 3.0+
+ public void openFileChooser(ValueCallback uploadMsg, String acceptType)
+ {
+ LOG.d(LOG_TAG, "File Chooser 3.0+");
+ mUploadCallback = uploadMsg;
+ Intent content = new Intent(Intent.ACTION_GET_CONTENT);
+ content.addCategory(Intent.CATEGORY_OPENABLE);
+
+ // run startActivityForResult
+ cordova.startActivityForResult(InAppBrowser.this, Intent.createChooser(content, "Select File"), FILECHOOSER_REQUESTCODE);
+ }
+
+ });
WebViewClient client = new InAppBrowserClient(thatWebView, edittext);
inAppWebView.setWebViewClient(client);
WebSettings settings = inAppWebView.getSettings();
@@ -696,7 +812,7 @@ public void onClick(View v) {
inAppWebView.loadUrl(url);
inAppWebView.setId(Integer.valueOf(6));
inAppWebView.getSettings().setLoadWithOverviewMode(true);
- inAppWebView.getSettings().setUseWideViewPort(true);
+ inAppWebView.getSettings().setUseWideViewPort(useWideViewPort);
inAppWebView.requestFocus();
inAppWebView.requestFocusFromTouch();
@@ -763,6 +879,42 @@ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Statu
}
}
+ /**
+ * Receive File Data from File Chooser
+ *
+ * @param requestCode the requested code from chromeclient
+ * @param resultCode the result code returned from android system
+ * @param intent the data from android file chooser
+ */
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ // For Android >= 5.0
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ LOG.d(LOG_TAG, "onActivityResult (For Android >= 5.0)");
+ // If RequestCode or Callback is Invalid
+ if(requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ return;
+ }
+ mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
+ mUploadCallbackLollipop = null;
+ }
+ // For Android < 5.0
+ else {
+ LOG.d(LOG_TAG, "onActivityResult (For Android < 5.0)");
+ // If RequestCode or Callback is Invalid
+ if(requestCode != FILECHOOSER_REQUESTCODE || mUploadCallback == null) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ return;
+ }
+
+ if (null == mUploadCallback) return;
+ Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData();
+
+ mUploadCallback.onReceiveValue(result);
+ mUploadCallback = null;
+ }
+ }
+
/**
* The webview client receives notifications about appView
*/
@@ -800,7 +952,7 @@ public boolean shouldOverrideUrlLoading(WebView webView, String url) {
} catch (android.content.ActivityNotFoundException e) {
LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
}
- } else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")) {
+ } else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:") || url.startsWith("intent:")) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
@@ -894,6 +1046,10 @@ public void onPageFinished(WebView view, String url) {
CookieSyncManager.getInstance().sync();
}
+ // https://issues.apache.org/jira/browse/CB-11248
+ view.clearFocus();
+ view.requestFocus();
+
try {
JSONObject obj = new JSONObject();
obj.put("type", LOAD_STOP_EVENT);
@@ -901,7 +1057,7 @@ public void onPageFinished(WebView view, String url) {
sendUpdate(obj, true);
} catch (JSONException ex) {
- Log.d(LOG_TAG, "Should never happen");
+ LOG.d(LOG_TAG, "Should never happen");
}
}
@@ -917,7 +1073,7 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
sendUpdate(obj, true, PluginResult.Status.ERROR);
} catch (JSONException ex) {
- Log.d(LOG_TAG, "Should never happen");
+ LOG.d(LOG_TAG, "Should never happen");
}
}
@@ -933,8 +1089,11 @@ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, Str
Method gpm = webView.getClass().getMethod("getPluginManager");
pluginManager = (PluginManager)gpm.invoke(webView);
} catch (NoSuchMethodException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
}
if (pluginManager == null) {
@@ -942,7 +1101,9 @@ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, Str
Field pmf = webView.getClass().getField("pluginManager");
pluginManager = (PluginManager)pmf.get(webView);
} catch (NoSuchFieldException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
+ LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}
diff --git a/src/android/InAppBrowserDialog.java b/src/android/InAppBrowserDialog.java
index d70172023..e7b212f28 100644
--- a/src/android/InAppBrowserDialog.java
+++ b/src/android/InAppBrowserDialog.java
@@ -21,7 +21,6 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
-import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/src/browser/InAppBrowserProxy.js b/src/browser/InAppBrowserProxy.js
index 6dfdd1ee4..2d17599e9 100644
--- a/src/browser/InAppBrowserProxy.js
+++ b/src/browser/InAppBrowserProxy.js
@@ -31,15 +31,30 @@ var browserWrap,
function attachNavigationEvents(element, callback) {
var onError = function () {
- callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true});
+ try {
+ callback({ type: "loaderror", url: this.contentWindow.location.href}, {keepCallback: true});
+ } catch (err) {
+ // blocked by CORS :\
+ callback({ type: "loaderror", url: null}, {keepCallback: true});
+ }
};
element.addEventListener("pageshow", function () {
- callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true});
+ try {
+ callback({ type: "loadstart", url: this.contentWindow.location.href}, {keepCallback: true});
+ } catch (err) {
+ // blocked by CORS :\
+ callback({ type: "loadstart", url: null}, {keepCallback: true});
+ }
});
element.addEventListener("load", function () {
- callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true});
+ try {
+ callback({ type: "loadstop", url: this.contentWindow.location.href}, {keepCallback: true});
+ } catch (err) {
+ // blocked by CORS :\
+ callback({ type: "loadstop", url: null}, {keepCallback: true});
+ }
});
element.addEventListener("error", onError);
@@ -49,7 +64,8 @@ function attachNavigationEvents(element, callback) {
var IAB = {
close: function (win, lose) {
if (browserWrap) {
- if (win) win({ type: "exit" });
+ // use the "open" function callback so that the exit event is fired properly
+ if (IAB._win) IAB._win({ type: "exit" });
browserWrap.parentNode.removeChild(browserWrap);
browserWrap = null;
@@ -68,6 +84,8 @@ var IAB = {
target = args[1],
features = args[2];
+ IAB._win = win;
+
if (target === "_self" || !target) {
window.location = strUrl;
} else if (target === "_system") {
@@ -77,15 +95,18 @@ var IAB = {
if (!browserWrap) {
browserWrap = document.createElement("div");
browserWrap.style.position = "absolute";
+ browserWrap.style.top = "0";
+ browserWrap.style.left = "0";
+ browserWrap.style.boxSizing = "border-box";
browserWrap.style.borderWidth = "40px";
- browserWrap.style.width = "calc(100% - 80px)";
- browserWrap.style.height = "calc(100% - 80px)";
+ browserWrap.style.width = "100vw";
+ browserWrap.style.height = "100vh";
browserWrap.style.borderStyle = "solid";
browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
browserWrap.onclick = function () {
setTimeout(function () {
- IAB.close(win);
+ IAB.close();
}, 0);
};
@@ -104,6 +125,7 @@ var IAB = {
if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) {
popup.style.height = "calc(100% - 60px)";
+ popup.style.marginBottom = "-4px";
navigationButtonsDiv = document.createElement("div");
navigationButtonsDiv.style.height = "60px";
@@ -157,7 +179,7 @@ var IAB = {
closeButton.innerHTML = "✖";
closeButton.addEventListener("click", function (e) {
setTimeout(function () {
- IAB.close(win);
+ IAB.close();
}, 0);
});
diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js
index c09e35835..33db1b9db 100644
--- a/src/firefoxos/InAppBrowserProxy.js
+++ b/src/firefoxos/InAppBrowserProxy.js
@@ -43,6 +43,10 @@ var IABExecs = {
console.error('[FirefoxOS] show not implemented');
},
+ hide: function (win, lose) {
+ console.error('[FirefoxOS] hide not implemented');
+ },
+
open: function (win, lose, args) {
var strUrl = args[0],
target = args[1],
diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h
index 6bb0ec160..d258eb09f 100644
--- a/src/ios/CDVInAppBrowser.h
+++ b/src/ios/CDVInAppBrowser.h
@@ -40,6 +40,7 @@
- (void)close:(CDVInvokedUrlCommand*)command;
- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
- (void)show:(CDVInvokedUrlCommand*)command;
+- (void)hide:(CDVInvokedUrlCommand*)command;
@end
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index 6d853b889..ffbab241c 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -29,6 +29,7 @@ Licensed to the Apache Software Foundation (ASF) under one
#define kInAppBrowserToolbarBarPositionTop @"top"
#define TOOLBAR_HEIGHT 44.0
+#define STATUSBAR_HEIGHT 20.0
#define LOCATIONBAR_HEIGHT 21.0
#define FOOTER_HEIGHT ((TOOLBAR_HEIGHT) + (LOCATIONBAR_HEIGHT))
@@ -149,7 +150,8 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
userAgent = overrideUserAgent;
}
if(appendUserAgent){
- userAgent = [NSString stringWithFormat:@"%@ %@", userAgent, appendUserAgent];
+ // userAgent = [NSString stringWithFormat:@"%@ %@", userAgent, appendUserAgent];
+ userAgent = [userAgent stringByAppendingString: appendUserAgent];
}
self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:userAgent prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
self.inAppBrowserViewController.navigationDelegate = self;
@@ -230,13 +232,45 @@ - (void)show:(CDVInvokedUrlCommand*)command
initWithRootViewController:self.inAppBrowserViewController];
nav.orientationDelegate = self.inAppBrowserViewController;
nav.navigationBarHidden = YES;
+ nav.modalPresentationStyle = self.inAppBrowserViewController.modalPresentationStyle;
__weak CDVInAppBrowser* weakSelf = self;
// Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) {
- [weakSelf.viewController presentViewController:nav animated:YES completion:nil];
+ CGRect frame = [[UIScreen mainScreen] bounds];
+ UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
+ UIViewController *tmpController = [[UIViewController alloc] init];
+ [tmpWindow setRootViewController:tmpController];
+ [tmpWindow setWindowLevel:UIWindowLevelNormal];
+
+ [tmpWindow makeKeyAndVisible];
+ [tmpController presentViewController:nav animated:YES completion:nil];
+ }
+ });
+}
+
+- (void)hide:(CDVInvokedUrlCommand*)command
+{
+ if (self.inAppBrowserViewController == nil) {
+ NSLog(@"Tried to hide IAB after it was closed.");
+ return;
+
+
+ }
+ if (_previousStatusBarStyle == -1) {
+ NSLog(@"Tried to hide IAB while already hidden");
+ return;
+ }
+
+ _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
+
+ // Run later to avoid the "took a long time" log message.
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (self.inAppBrowserViewController != nil) {
+ _previousStatusBarStyle = -1;
+ [self.inAppBrowserViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
});
}
@@ -260,11 +294,8 @@ - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
- (void)openInSystem:(NSURL*)url
{
- if ([[UIApplication sharedApplication] canOpenURL:url]) {
- [[UIApplication sharedApplication] openURL:url];
- } else { // handle any custom schemes to plugins
- [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
- }
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
+ [[UIApplication sharedApplication] openURL:url];
}
// This is a helper method for the inject{Script|Style}{Code|File} API calls, which
@@ -1018,11 +1049,11 @@ - (void) dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))com
- (void) viewDidLoad {
- CGRect frame = [UIApplication sharedApplication].statusBarFrame;
-
+ CGRect statusBarFrame = [self invertFrameIfNeeded:[UIApplication sharedApplication].statusBarFrame];
+ statusBarFrame.size.height = STATUSBAR_HEIGHT;
// simplified from: http://stackoverflow.com/a/25669695/219684
- UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:[self invertFrameIfNeeded:frame]];
+ UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:statusBarFrame];
bgToolbar.barStyle = UIBarStyleDefault;
[bgToolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self.view addSubview:bgToolbar];
diff --git a/src/osx/CDVInAppBrowser.h b/src/osx/CDVInAppBrowser.h
new file mode 100644
index 000000000..742af70a4
--- /dev/null
+++ b/src/osx/CDVInAppBrowser.h
@@ -0,0 +1,30 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import
+
+@interface CDVInAppBrowser : CDVPlugin {
+}
+
+@property (nonatomic, copy) NSString* callbackId;
+
+- (void)open:(CDVInvokedUrlCommand*)command;
+
+@end
+
diff --git a/src/osx/CDVInAppBrowser.m b/src/osx/CDVInAppBrowser.m
new file mode 100644
index 000000000..9d579e152
--- /dev/null
+++ b/src/osx/CDVInAppBrowser.m
@@ -0,0 +1,89 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVInAppBrowser.h"
+#import
+
+#define kInAppBrowserTargetSelf @"_self"
+#define kInAppBrowserTargetSystem @"_system"
+#define kInAppBrowserTargetBlank @"_blank"
+
+@interface CDVInAppBrowser () {
+}
+@end
+
+@implementation CDVInAppBrowser
+
+- (void)pluginInitialize
+{
+}
+
+- (BOOL) isSystemUrl:(NSURL*)url
+{
+ if ([[url host] isEqualToString:@"itunes.apple.com"]) {
+ return YES;
+ }
+
+ return NO;
+}
+
+- (void)open:(CDVInvokedUrlCommand*)command
+{
+ CDVPluginResult* pluginResult;
+
+ NSString* url = [command argumentAtIndex:0];
+ NSString* target = [command argumentAtIndex:1 withDefault:kInAppBrowserTargetSelf];
+
+ self.callbackId = command.callbackId;
+
+ if (url != nil) {
+
+ NSURL* baseUrl = [NSURL URLWithString:url];
+
+ NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
+
+ if ([self isSystemUrl:absoluteUrl]) {
+ target = kInAppBrowserTargetSystem;
+ }
+
+ if ([target isEqualToString:kInAppBrowserTargetSelf]) {
+ //[self openInCordovaWebView:absoluteUrl withOptions:options];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not Yet Implemented for OSX: [self openInCordovaWebView:absoluteUrl withOptions:options]"];
+ } else if ([target isEqualToString:kInAppBrowserTargetSystem]) {
+ [self openInSystem:absoluteUrl];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ } else { // _blank or anything else
+ //[self openInInAppBrowser:absoluteUrl withOptions:options];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not Yet Implemented for OSX: [self openInInAppBrowser:absoluteUrl withOptions:options]"];
+ }
+
+ } else {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"incorrect number of arguments"];
+ }
+ [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (void)openInSystem:(NSURL*)url
+{
+ [[NSWorkspace sharedWorkspace] openURL:url];
+}
+
+@end
+
diff --git a/src/ubuntu/inappbrowser.cpp b/src/ubuntu/inappbrowser.cpp
index c5a9e64a1..a928effa2 100644
--- a/src/ubuntu/inappbrowser.cpp
+++ b/src/ubuntu/inappbrowser.cpp
@@ -65,6 +65,10 @@ void Inappbrowser::show(int, int) {
m_cordova->execQML("CordovaWrapper.global.inappbrowser.visible = true");
}
+void Inappbrowser::hide(int, int) {
+ m_cordova->execQML("CordovaWrapper.global.inappbrowser.visible = false");
+}
+
void Inappbrowser::close(int, int) {
m_cordova->execQML("CordovaWrapper.global.inappbrowser.destroy()");
this->callbackWithoutRemove(_eventCb, EXIT_EVENT);
diff --git a/src/ubuntu/inappbrowser.h b/src/ubuntu/inappbrowser.h
index 1da4e033c..9ad61ecd3 100644
--- a/src/ubuntu/inappbrowser.h
+++ b/src/ubuntu/inappbrowser.h
@@ -46,6 +46,7 @@ class Inappbrowser: public CPlugin {
public slots:
void open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures);
void show(int, int);
+ void hide(int, int);
void close(int, int);
void injectStyleFile(int cb, int, const QString&, bool);
void injectStyleCode(int cb, int, const QString&, bool);
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index b9880b39a..dec91dba2 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -33,7 +33,8 @@ var browserWrap,
forwardButton,
closeButton,
bodyOverflowStyle,
- navigationEventsCallback;
+ navigationEventsCallback,
+ hardwareBackCallback;
// x-ms-webview is available starting from Windows 8.1 (platformId is 'windows')
// http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx
@@ -105,6 +106,8 @@ var IAB = {
document.body.style.msOverflowStyle = bodyOverflowStyle;
browserWrap = null;
popup = null;
+
+ document.removeEventListener("backbutton", hardwareBackCallback, false);
}
});
},
@@ -115,6 +118,11 @@ var IAB = {
}
});
},
+ hide: function (win, lose) {
+ if (browserWrap) {
+ browserWrap.style.display = "none";
+ }
+ },
open: function (win, lose, args) {
// make function async so that we can add navigation events handlers before view is loaded and navigation occured
setImmediate(function () {
@@ -173,9 +181,45 @@ var IAB = {
}
popup.style.borderWidth = "0px";
popup.style.width = "100%";
+ popup.style.marginBottom = "-5px";
browserWrap.appendChild(popup);
+ var closeHandler = function (e) {
+ setTimeout(function () {
+ IAB.close(navigationEventsCallback);
+ }, 0);
+ };
+
+ if (features.indexOf("hardwareback=yes") > -1 || features.indexOf("hardwareback") === -1) {
+ hardwareBackCallback = function () {
+ if (browserWrap.style.display === 'none') {
+ // NOTE: backbutton handlers have to throw an exception in order to prevent
+ // returning 'true' inside cordova-js, which would mean that the event is handled by user.
+ // Throwing an exception means that the default/system navigation behavior will take place,
+ // which is to exit the app if the navigation stack is empty.
+ throw 'Exit the app';
+ }
+
+ if (popup.canGoBack) {
+ popup.goBack();
+ } else {
+ closeHandler();
+ }
+ };
+ } else if (features.indexOf("hardwareback=no") > -1) {
+ hardwareBackCallback = function () {
+ if (browserWrap.style.display === 'none') {
+ // See comment above
+ throw 'Exit the app';
+ }
+
+ closeHandler();
+ };
+ }
+
+ document.addEventListener("backbutton", hardwareBackCallback, false);
+
if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) {
popup.style.height = "calc(100% - 70px)";
@@ -210,11 +254,7 @@ var IAB = {
closeButton = document.createElement("div");
closeButton.innerText = "close";
closeButton.className = "app-bar-action action-close";
- closeButton.addEventListener("click", function (e) {
- setTimeout(function () {
- IAB.close(navigationEventsCallback);
- }, 0);
- });
+ closeButton.addEventListener("click", closeHandler);
if (!isWebViewAvailable) {
// iframe navigation is not yet supported
@@ -273,7 +313,8 @@ var IAB = {
}
if (isWebViewAvailable && browserWrap && popup) {
- var uri = new Windows.Foundation.Uri(filePath);
+ // CB-12364 getFileFromApplicationUriAsync does not support ms-appx-web
+ var uri = new Windows.Foundation.Uri(filePath.replace('ms-appx-web:', 'ms-appx:'));
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) {
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
var op = popup.invokeScriptAsync("eval", code);
@@ -310,7 +351,8 @@ var IAB = {
filePath = filePath && urlutil.makeAbsolute(filePath);
if (isWebViewAvailable && browserWrap && popup) {
- var uri = new Windows.Foundation.Uri(filePath);
+ // CB-12364 getFileFromApplicationUriAsync does not support ms-appx-web
+ var uri = new Windows.Foundation.Uri(filePath.replace('ms-appx-web:', 'ms-appx:'));
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(function (file) {
return Windows.Storage.FileIO.readTextAsync(file);
}).done(function (code) {
diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs
index ddb512271..fa6fbe448 100644
--- a/src/wp/InAppBrowser.cs
+++ b/src/wp/InAppBrowser.cs
@@ -131,6 +131,21 @@ public void show(string options)
}
}
+ public void hide(string options)
+ {
+ string[] args = JSON.JsonHelper.Deserialize(options);
+
+
+ if (browser != null)
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
+ {
+ browser.Visibility = Visibility.Collapsed;
+ AppBar.IsVisible = false;
+ });
+ }
+ }
+
public void injectScriptCode(string options)
{
string[] args = JSON.JsonHelper.Deserialize(options);
diff --git a/tests/package.json b/tests/package.json
new file mode 100644
index 000000000..7c0577868
--- /dev/null
+++ b/tests/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "cordova-plugin-inappbrowser-tests",
+ "version": "1.7.1-dev",
+ "description": "",
+ "cordova": {
+ "id": "cordova-plugin-inappbrowser-tests",
+ "platforms": []
+ },
+ "keywords": [
+ "ecosystem:cordova"
+ ],
+ "author": "",
+ "license": "Apache 2.0"
+}
diff --git a/tests/plugin.xml b/tests/plugin.xml
index 9583f9f67..78c951027 100644
--- a/tests/plugin.xml
+++ b/tests/plugin.xml
@@ -20,7 +20,7 @@
+ version="1.7.2-dev">
Cordova InAppBrowser Plugin TestsApache 2.0
diff --git a/tests/tests.js b/tests/tests.js
index 8ba8ee2d7..7d6c79b51 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -23,9 +23,14 @@
/* global MSApp */
var cordova = require('cordova');
-var isWindows = cordova.platformId == 'windows';
+var isWindows = cordova.platformId === 'windows';
+var isBrowser = cordova.platformId === 'browser';
window.alert = window.alert || navigator.notification.alert;
+if (isWindows && navigator && navigator.notification && navigator.notification.alert) {
+ // window.alert is defined but not functional on UWP
+ window.alert = navigator.notification.alert;
+}
exports.defineAutoTests = function () {
@@ -43,6 +48,11 @@ exports.defineAutoTests = function () {
describe('open method', function () {
+ if (cordova.platformId == 'osx') {
+ pending('Open method not fully supported on OSX.');
+ return;
+ }
+
var iabInstance;
var originalTimeout;
var url = 'https://dist.apache.org/repos/dist/dev/cordova/';
@@ -71,7 +81,8 @@ exports.defineAutoTests = function () {
function verifyEvent(evt, type) {
expect(evt).toBeDefined();
expect(evt.type).toEqual(type);
- if (type !== 'exit') { // `exit` event does not have url field
+ // `exit` event does not have url field, browser returns null url for CORS requests
+ if (type !== 'exit' && !isBrowser) {
expect(evt.url).toEqual(url);
}
}
@@ -84,7 +95,7 @@ exports.defineAutoTests = function () {
expect(evt.message).toEqual(jasmine.any(String));
}
- it("inappbrowser.spec.3 should retun InAppBrowser instance with required methods", function () {
+ it("inappbrowser.spec.3 should return InAppBrowser instance with required methods", function () {
iabInstance = cordova.InAppBrowser.open(url, '_blank');
expect(iabInstance).toBeDefined();
@@ -93,6 +104,7 @@ exports.defineAutoTests = function () {
expect(iabInstance.removeEventListener).toEqual(jasmine.any(Function));
expect(iabInstance.close).toEqual(jasmine.any(Function));
expect(iabInstance.show).toEqual(jasmine.any(Function));
+ expect(iabInstance.hide).toEqual(jasmine.any(Function));
expect(iabInstance.executeScript).toEqual(jasmine.any(Function));
expect(iabInstance.insertCSS).toEqual(jasmine.any(Function));
});
@@ -106,7 +118,11 @@ exports.defineAutoTests = function () {
iabInstance.addEventListener('loadstart', onLoadStart);
iabInstance.addEventListener('loadstop', function (evt) {
verifyEvent(evt, 'loadstop');
- expect(onLoadStart).toHaveBeenCalled();
+ if (!isBrowser) {
+ // according to documentation, "loadstart" event is not supported on browser
+ // https://github.com/apache/cordova-plugin-inappbrowser#browser-quirks-1
+ expect(onLoadStart).toHaveBeenCalled();
+ }
done();
});
});
@@ -122,6 +138,11 @@ exports.defineAutoTests = function () {
});
it("inappbrowser.spec.6 should support loaderror event", function (done) {
+ if (isBrowser) {
+ // according to documentation, "loaderror" event is not supported on browser
+ // https://github.com/apache/cordova-plugin-inappbrowser#browser-quirks-1
+ pending('Browser platform doesn\'t support loaderror event');
+ }
iabInstance = cordova.InAppBrowser.open(badUrl, '_blank');
iabInstance.addEventListener('loaderror', function (evt) {
verifyLoadErrorEvent(evt);
@@ -416,7 +437,9 @@ exports.defineManualTests = function (contentEl, createActionButton) {
' ' +
'Expected result: no output. But click on "show hidden" again and nothing should be shown.' +
' ' +
- 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk';
+ 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk' +
+ ' ' +
+ 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk. Hide after 2 seconds';
var clearing_cache_tests = '
Clearing Cache
' +
'' +
@@ -438,16 +461,26 @@ exports.defineManualTests = function (contentEl, createActionButton) {
' ' +
'Expected result: open successfully in InAppBrowser to the local page, scrolled to the beginning of the tall div with border.';
+ var hardwareback_tests = '
HardwareBack
' +
+ ' ' +
+ 'Expected result: By default hardwareback is yes so pressing back button should navigate backwards in history then close InAppBrowser' +
+ ' ' +
+ 'Expected result: hardwareback=yes pressing back button should navigate backwards in history then close InAppBrowser' +
+ ' ' +
+ 'Expected result: hardwareback=no pressing back button should close InAppBrowser regardless history' +
+ ' ' +
+ 'Expected result: consistently open browsers with with the appropriate option: hardwareback=defaults to yes then hardwareback=no then hardwareback=defaults to yes. By default hardwareback is yes so pressing back button should navigate backwards in history then close InAppBrowser';
+
// CB-7490 We need to wrap this code due to Windows security restrictions
// see http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences for details
if (window.MSApp && window.MSApp.execUnsafeLocalFunction) {
MSApp.execUnsafeLocalFunction(function() {
contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests +
- css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests;
+ css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests;
});
} else {
contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests +
- css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests;
+ css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests;
}
document.getElementById("user-agent").textContent = navigator.userAgent;
@@ -605,6 +638,12 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton('google.co.uk Not Hidden', function () {
openHidden('https://www.google.co.uk', false);
}, 'openHiddenShow');
+ createActionButton('google.co.uk shown for 2 seconds than hidden', function () {
+ var iab = doOpen('https://www.google.co.uk/', 'random_sting');
+ setTimeout(function () {
+ iab.hide();
+ }, 2000);
+ }, 'openVisibleAndHide');
//Clearing cache
createActionButton('Clear Browser Cache', function () {
@@ -632,4 +671,30 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton('Anchor2', function () {
doOpen(localhtml + '#anchor2', '_blank');
}, 'openAnchor2');
+
+ // Hardwareback
+ createActionButton('no hardwareback (defaults to yes)', function () {
+ doOpen('http://cordova.apache.org', '_blank');
+ }, 'openHardwareBackDefault');
+ createActionButton('hardwareback=yes', function () {
+ doOpen('http://cordova.apache.org', '_blank', 'hardwareback=yes');
+ }, 'openHardwareBackYes');
+ createActionButton('hardwareback=no', function () {
+ doOpen('http://cordova.apache.org', '_blank', 'hardwareback=no');
+ }, 'openHardwareBackNo');
+ createActionButton('no hardwareback -> hardwareback=no -> no hardwareback', function() {
+ var ref = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes');
+ ref.addEventListener('loadstop', function() {
+ ref.close();
+ });
+ ref.addEventListener('exit', function() {
+ var ref2 = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes,hardwareback=no');
+ ref2.addEventListener('loadstop', function() {
+ ref2.close();
+ });
+ ref2.addEventListener('exit', function() {
+ cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes');
+ });
+ });
+ }, 'openHardwareBackDefaultAfterNo');
};
diff --git a/types/index.d.ts b/types/index.d.ts
new file mode 100644
index 000000000..ea3d3adba
--- /dev/null
+++ b/types/index.d.ts
@@ -0,0 +1,221 @@
+// Type definitions for Apache Cordova InAppBrowser plugin
+// Project: https://github.com/apache/cordova-plugin-inappbrowser
+// Definitions by: Microsoft Open Technologies Inc
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+//
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license.
+
+interface Window {
+ /**
+ * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
+ * @param url The URL to load.
+ * @param target The target in which to load the URL, an optional parameter that defaults to _self.
+ * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
+ * The options string must not contain any blank space, and each feature's
+ * name/value pairs must be separated by a comma. Feature names are case insensitive.
+ */
+ open(url: string, target?: "_self", options?: string): InAppBrowser;
+ /**
+ * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
+ * @param url The URL to load.
+ * @param target The target in which to load the URL, an optional parameter that defaults to _self.
+ * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
+ * The options string must not contain any blank space, and each feature's
+ * name/value pairs must be separated by a comma. Feature names are case insensitive.
+ */
+ open(url: string, target?: "_blank", options?: string): InAppBrowser;
+ /**
+ * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
+ * @param url The URL to load.
+ * @param target The target in which to load the URL, an optional parameter that defaults to _self.
+ * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
+ * The options string must not contain any blank space, and each feature's
+ * name/value pairs must be separated by a comma. Feature names are case insensitive.
+ */
+ open(url: string, target?: "_system", options?: string): InAppBrowser;
+ /**
+ * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
+ * @param url The URL to load.
+ * @param target The target in which to load the URL, an optional parameter that defaults to _self.
+ * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
+ * The options string must not contain any blank space, and each feature's
+ * name/value pairs must be separated by a comma. Feature names are case insensitive.
+ */
+ open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser;
+}
+
+/**
+ * The object returned from a call to window.open.
+ * NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
+ */
+interface InAppBrowser extends Window {
+ onloadstart: (type: InAppBrowserEvent) => void;
+ onloadstop: (type: InAppBrowserEvent) => void;
+ onloaderror: (type: InAppBrowserEvent) => void;
+ onexit: (type: InAppBrowserEvent) => void;
+ // addEventListener overloads
+ /**
+ * Adds a listener for an event from the InAppBrowser.
+ * @param type the event to listen for
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Adds a listener for an event from the InAppBrowser.
+ * @param type the event to listen for
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Adds a listener for an event from the InAppBrowser.
+ * @param type the event to listen for
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Adds a listener for an event from the InAppBrowser.
+ * @param type the event to listen for
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Adds a listener for an event from the InAppBrowser.
+ * @param type the event to listen for
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an Event object as a parameter.
+ */
+ addEventListener(type: string, callback: (event: Event) => void): void;
+ // removeEventListener overloads
+ /**
+ * Removes a listener for an event from the InAppBrowser.
+ * @param type The event to stop listening for.
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Removes a listener for an event from the InAppBrowser.
+ * @param type The event to stop listening for.
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Removes a listener for an event from the InAppBrowser.
+ * @param type The event to stop listening for.
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Removes a listener for an event from the InAppBrowser.
+ * @param type The event to stop listening for.
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an InAppBrowserEvent object as a parameter.
+ */
+ removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
+ /**
+ * Removes a listener for an event from the InAppBrowser.
+ * @param type The event to stop listening for.
+ * loadstart: event fires when the InAppBrowser starts to load a URL.
+ * loadstop: event fires when the InAppBrowser finishes loading a URL.
+ * loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
+ * exit: event fires when the InAppBrowser window is closed.
+ * @param callback the function that executes when the event fires. The function is
+ * passed an Event object as a parameter.
+ */
+ removeEventListener(type: string, callback: (event: Event) => void): void;
+ /** Closes the InAppBrowser window. */
+ close(): void;
+ /** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */
+ hide(): void;
+ /**
+ * Displays an InAppBrowser window that was opened hidden. Calling this has no effect
+ * if the InAppBrowser was already visible.
+ */
+ show(): void;
+ /**
+ * Injects JavaScript code into the InAppBrowser window.
+ * @param script Details of the script to run, specifying either a file or code key.
+ * @param callback The function that executes after the JavaScript code is injected.
+ * If the injected script is of type code, the callback executes with
+ * a single parameter, which is the return value of the script, wrapped in an Array.
+ * For multi-line scripts, this is the return value of the last statement,
+ * or the last expression evaluated.
+ */
+ executeScript(script: { code: string }, callback: (result: any) => void): void;
+ /**
+ * Injects JavaScript code into the InAppBrowser window.
+ * @param script Details of the script to run, specifying either a file or code key.
+ * @param callback The function that executes after the JavaScript code is injected.
+ * If the injected script is of type code, the callback executes with
+ * a single parameter, which is the return value of the script, wrapped in an Array.
+ * For multi-line scripts, this is the return value of the last statement,
+ * or the last expression evaluated.
+ */
+ executeScript(script: { file: string }, callback: (result: any) => void): void;
+ /**
+ * Injects CSS into the InAppBrowser window.
+ * @param css Details of the script to run, specifying either a file or code key.
+ * @param callback The function that executes after the CSS is injected.
+ */
+ insertCSS(css: { code: string }, callback: () => void): void;
+ /**
+ * Injects CSS into the InAppBrowser window.
+ * @param css Details of the script to run, specifying either a file or code key.
+ * @param callback The function that executes after the CSS is injected.
+ */
+ insertCSS(css: { file: string }, callback: () => void): void;
+}
+
+interface InAppBrowserEvent extends Event {
+ /** the eventname, either loadstart, loadstop, loaderror, or exit. */
+ type: string;
+ /** the URL that was loaded. */
+ url: string;
+ /** the error code, only in the case of loaderror. */
+ code: number;
+ /** the error message, only in the case of loaderror. */
+ message: string;
+}
\ No newline at end of file
diff --git a/www/inappbrowser.js b/www/inappbrowser.js
index 25f627119..983dbba8c 100644
--- a/www/inappbrowser.js
+++ b/www/inappbrowser.js
@@ -50,7 +50,10 @@
exec(null, null, "InAppBrowser", "close", []);
},
show: function (eventname) {
- exec(null, null, "InAppBrowser", "show", []);
+ exec(null, null, "InAppBrowser", "show", []);
+ },
+ hide: function (eventname) {
+ exec(null, null, "InAppBrowser", "hide", []);
},
addEventListener: function (eventname,f) {
if (eventname in this.channels) {
diff --git a/www/windows8/InAppBrowserProxy.js b/www/windows8/InAppBrowserProxy.js
index ed9547701..d780fcd08 100644
--- a/www/windows8/InAppBrowserProxy.js
+++ b/www/windows8/InAppBrowserProxy.js
@@ -38,6 +38,12 @@ var IAB = {
}*/
},
+ hide: function (win, lose) {
+ /* empty block, ran out of bacon?
+ if (browserWrap) {
+
+ }*/
+ },
open: function (win, lose, args) {
var strUrl = args[0],
target = args[1],