mirror of
https://github.com/shuto-cn/cordova-plugin-inappbrowser.git
synced 2026-04-16 00:00:05 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ae4130296 | |||
| 32c0e41c43 | |||
| 43592a4789 | |||
| 4b3a838704 | |||
| ac0bdee8e6 | |||
| 22b3f0ccd4 | |||
| 6e0ea336fc | |||
| f47f5449c2 | |||
| d828197de4 | |||
| 6e38667320 | |||
| ea6a4fc80a | |||
| ac9c64964e | |||
| 225bde271b | |||
| e5d07f14e8 | |||
| 863386398e | |||
| ef9ca5ad3e |
+13
-2
@@ -130,6 +130,17 @@
|
|||||||
* CB-7133 fix up the tests for Android
|
* CB-7133 fix up the tests for Android
|
||||||
* Add just a bit more logging
|
* Add just a bit more logging
|
||||||
* CB-7133 port inappbrowser to plugin-test-framework
|
* CB-7133 port inappbrowser to plugin-test-framework
|
||||||
* phonegap events supported for _blank target
|
* phonegap events supported for \_blank target
|
||||||
* inappbrowser _blank target position is fixed
|
* inappbrowser \_blank target position is fixed
|
||||||
* amazon-fireos related changes.
|
* amazon-fireos related changes.
|
||||||
|
|
||||||
|
### 0.5.3 (Oct 03, 2014)
|
||||||
|
* Windows implementation fixes and improvements
|
||||||
|
* zIndex fixed
|
||||||
|
* renamed InAppBrowser back to inappbrowser for case sensitive operating systems
|
||||||
|
* 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
|
||||||
|
|||||||
+12
-2
@@ -57,7 +57,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
|||||||
Android uniquement :
|
Android uniquement :
|
||||||
|
|
||||||
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton.
|
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton.
|
||||||
* **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||||
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
||||||
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
|||||||
|
|
||||||
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même.
|
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même.
|
||||||
* **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce.
|
* **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce.
|
||||||
* **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||||
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
||||||
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
||||||
* **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`)
|
* **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`)
|
||||||
@@ -77,6 +77,10 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
|||||||
* **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][1] (par défaut,`fullscreen`).
|
* **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][1] (par défaut,`fullscreen`).
|
||||||
* **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][2] (par défaut,`coververtical`).
|
* **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][2] (par défaut,`coververtical`).
|
||||||
* **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre.
|
* **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre.
|
||||||
|
|
||||||
|
Windows uniquement :
|
||||||
|
|
||||||
|
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||||
|
|
||||||
[1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
[1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||||
[2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
[2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||||
@@ -88,6 +92,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
|||||||
* BlackBerry 10
|
* BlackBerry 10
|
||||||
* Firefox OS
|
* Firefox OS
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
* Windows Phone 7 et 8
|
* Windows Phone 7 et 8
|
||||||
|
|
||||||
### Exemple
|
### Exemple
|
||||||
@@ -172,6 +177,7 @@ L'objet retourné par un appel à`window.open`.
|
|||||||
* Amazon Fire OS
|
* Amazon Fire OS
|
||||||
* Android
|
* Android
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
* Windows Phone 7 et 8
|
* Windows Phone 7 et 8
|
||||||
|
|
||||||
### Petit exemple
|
### Petit exemple
|
||||||
@@ -203,6 +209,7 @@ L'objet retourné par un appel à`window.open`.
|
|||||||
* Amazon Fire OS
|
* Amazon Fire OS
|
||||||
* Android
|
* Android
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
* Windows Phone 7 et 8
|
* Windows Phone 7 et 8
|
||||||
|
|
||||||
### Petit exemple
|
### Petit exemple
|
||||||
@@ -228,6 +235,7 @@ L'objet retourné par un appel à`window.open`.
|
|||||||
* Android
|
* Android
|
||||||
* Firefox OS
|
* Firefox OS
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
* Windows Phone 7 et 8
|
* Windows Phone 7 et 8
|
||||||
|
|
||||||
### Petit exemple
|
### Petit exemple
|
||||||
@@ -250,6 +258,7 @@ L'objet retourné par un appel à`window.open`.
|
|||||||
* Amazon Fire OS
|
* Amazon Fire OS
|
||||||
* Android
|
* Android
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
|
|
||||||
### Petit exemple
|
### Petit exemple
|
||||||
|
|
||||||
@@ -281,6 +290,7 @@ L'objet retourné par un appel à`window.open`.
|
|||||||
* Amazon Fire OS
|
* Amazon Fire OS
|
||||||
* Android
|
* Android
|
||||||
* iOS
|
* iOS
|
||||||
|
* Windows 8 et 8.1
|
||||||
|
|
||||||
### Petit exemple
|
### Petit exemple
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ 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`).
|
- __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.
|
- __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window.
|
||||||
|
|
||||||
|
Windows only:
|
||||||
|
|
||||||
|
- __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.
|
||||||
|
|
||||||
### Supported Platforms
|
### Supported Platforms
|
||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
@@ -84,6 +88,7 @@ instance, or the system browser.
|
|||||||
- BlackBerry 10
|
- BlackBerry 10
|
||||||
- Firefox OS
|
- Firefox OS
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
@@ -169,6 +174,7 @@ The object returned from a call to `window.open`.
|
|||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
@@ -199,6 +205,7 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
@@ -222,6 +229,7 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
- Android
|
- Android
|
||||||
- Firefox OS
|
- Firefox OS
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
@@ -242,6 +250,7 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
|
|
||||||
@@ -273,6 +282,7 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- iOS
|
- iOS
|
||||||
|
- Windows 8 and 8.1
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
|
|
||||||
|
|||||||
+16
-6
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
id="org.apache.cordova.inappbrowser"
|
id="org.apache.cordova.inappbrowser"
|
||||||
version="0.5.2">
|
version="0.5.3">
|
||||||
|
|
||||||
<name>InAppBrowser</name>
|
<name>InAppBrowser</name>
|
||||||
<description>Cordova InAppBrowser Plugin</description>
|
<description>Cordova InAppBrowser Plugin</description>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<engines>
|
<engines>
|
||||||
<engine name="cordova" version=">=3.1.0" /><!-- Needs cordova/urlutil -->
|
<engine name="cordova" version=">=3.1.0" /><!-- Needs cordova/urlutil -->
|
||||||
</engines>
|
</engines>
|
||||||
|
|
||||||
<!-- android -->
|
<!-- android -->
|
||||||
<platform name="android">
|
<platform name="android">
|
||||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
||||||
|
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
<!-- amazon-fireos -->
|
<!-- amazon-fireos -->
|
||||||
<platform name="amazon-fireos">
|
<platform name="amazon-fireos">
|
||||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_remove.png" target="res/drawable-xhdpi/ic_action_remove.png" />
|
<resource-file src="src/android/res/drawable-xhdpi/ic_action_remove.png" target="res/drawable-xhdpi/ic_action_remove.png" />
|
||||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
<!-- ubuntu -->
|
<!-- ubuntu -->
|
||||||
<platform name="ubuntu">
|
<platform name="ubuntu">
|
||||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||||
@@ -179,7 +179,17 @@
|
|||||||
<merges target="" />
|
<merges target="" />
|
||||||
</js-module>
|
</js-module>
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
|
<!-- windows universal apps (Windows 8.1, Windows Phone 8.1, Windows 8.0) -->
|
||||||
|
<platform name="windows">
|
||||||
|
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||||
|
<clobbers target="window.open" />
|
||||||
|
</js-module>
|
||||||
|
<js-module src="src/windows/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||||
|
<merges target="" />
|
||||||
|
</js-module>
|
||||||
|
</platform>
|
||||||
|
|
||||||
<!-- firefoxos -->
|
<!-- firefoxos -->
|
||||||
<platform name="firefoxos">
|
<platform name="firefoxos">
|
||||||
<config-file target="config.xml" parent="/*">
|
<config-file target="config.xml" parent="/*">
|
||||||
@@ -191,6 +201,6 @@
|
|||||||
<js-module src="src/firefoxos/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
<js-module src="src/firefoxos/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||||
<merges target="" />
|
<merges target="" />
|
||||||
</js-module>
|
</js-module>
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ var IABExecs = {
|
|||||||
function updateIframeSizeNoLocation() {
|
function updateIframeSizeNoLocation() {
|
||||||
browserWrap.style.width = window.innerWidth + 'px';
|
browserWrap.style.width = window.innerWidth + 'px';
|
||||||
browserWrap.style.height = window.innerHeight + 'px';
|
browserWrap.style.height = window.innerHeight + 'px';
|
||||||
|
browserWrap.style.zIndex = '999999999';
|
||||||
browserWrap.browser.style.height = (window.innerHeight - 60) + 'px';
|
browserWrap.browser.style.height = (window.innerHeight - 60) + 'px';
|
||||||
browserWrap.browser.style.width = browserWrap.style.width;
|
browserWrap.browser.style.width = browserWrap.style.width;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint sloppy:true */
|
||||||
|
/*global Windows:true, require, document, setTimeout, window, module */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var cordova = require('cordova'),
|
||||||
|
channel = require('cordova/channel');
|
||||||
|
|
||||||
|
var browserWrap,
|
||||||
|
popup;
|
||||||
|
|
||||||
|
// x-ms-webview is available starting from Windows 8.1 (platformId is 'windows')
|
||||||
|
// http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx
|
||||||
|
var isWebViewAvailable = cordova.platformId == 'windows';
|
||||||
|
|
||||||
|
function attachNavigationEvents(element, callback) {
|
||||||
|
if (isWebViewAvailable) {
|
||||||
|
element.addEventListener("MSWebViewNavigationStarting", function (e) {
|
||||||
|
callback({ type: "loadstart", url: e.uri}, {keepCallback: true} );
|
||||||
|
});
|
||||||
|
element.addEventListener("MSWebViewNavigationCompleted", function (e) {
|
||||||
|
callback({ type: e.isSuccess ? "loadstop" : "loaderror", url: e.uri}, {keepCallback: true});
|
||||||
|
});
|
||||||
|
element.addEventListener("MSWebViewUnviewableContentIdentified", function (e) {
|
||||||
|
// WebView found the content to be not HTML.
|
||||||
|
// http://msdn.microsoft.com/en-us/library/windows/apps/dn609716.aspx
|
||||||
|
callback({ type: "loaderror", url: e.uri}, {keepCallback: true});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var onError = function () {
|
||||||
|
callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
element.addEventListener("unload", function () {
|
||||||
|
callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true});
|
||||||
|
});
|
||||||
|
element.addEventListener("load", function () {
|
||||||
|
callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true});
|
||||||
|
});
|
||||||
|
|
||||||
|
element.addEventListener("error", onError);
|
||||||
|
element.addEventListener("abort", onError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var IAB = {
|
||||||
|
close: function (win, lose) {
|
||||||
|
if (browserWrap) {
|
||||||
|
if (win) win({ type: "exit" });
|
||||||
|
|
||||||
|
browserWrap.parentNode.removeChild(browserWrap);
|
||||||
|
browserWrap = null;
|
||||||
|
popup = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show: function (win, lose) {
|
||||||
|
if (browserWrap) {
|
||||||
|
browserWrap.style.display = "block";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
open: function (win, lose, args) {
|
||||||
|
var strUrl = args[0],
|
||||||
|
target = args[1],
|
||||||
|
features = args[2],
|
||||||
|
url;
|
||||||
|
|
||||||
|
if (target === "_system") {
|
||||||
|
url = new Windows.Foundation.Uri(strUrl);
|
||||||
|
Windows.System.Launcher.launchUriAsync(url);
|
||||||
|
} else if (target === "_blank") {
|
||||||
|
if (!browserWrap) {
|
||||||
|
browserWrap = document.createElement("div");
|
||||||
|
browserWrap.style.position = "absolute";
|
||||||
|
browserWrap.style.borderWidth = "40px";
|
||||||
|
browserWrap.style.width = "calc(100% - 80px)";
|
||||||
|
browserWrap.style.height = "calc(100% - 80px)";
|
||||||
|
browserWrap.style.borderStyle = "solid";
|
||||||
|
browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
|
||||||
|
|
||||||
|
browserWrap.onclick = function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
IAB.close();
|
||||||
|
}, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
document.body.appendChild(browserWrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (features.indexOf("hidden=yes") !== -1) {
|
||||||
|
browserWrap.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
popup = document.createElement(isWebViewAvailable ? "x-ms-webview" : "iframe");
|
||||||
|
popup.style.borderWidth = "0px";
|
||||||
|
popup.style.width = "100%";
|
||||||
|
popup.style.height = "100%";
|
||||||
|
popup.src = strUrl;
|
||||||
|
|
||||||
|
// start listening for navigation events
|
||||||
|
attachNavigationEvents(popup, win);
|
||||||
|
|
||||||
|
browserWrap.appendChild(popup);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
window.location = strUrl;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
injectScriptCode: function (win, fail, args) {
|
||||||
|
var code = args[0],
|
||||||
|
hasCallback = args[1];
|
||||||
|
|
||||||
|
if (isWebViewAvailable && browserWrap && popup) {
|
||||||
|
var op = popup.invokeScriptAsync("eval", code);
|
||||||
|
op.oncomplete = function () { hasCallback && win([]); };
|
||||||
|
op.onerror = function () { };
|
||||||
|
op.start();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
injectScriptFile: function (win, fail, args) {
|
||||||
|
var file = args[0],
|
||||||
|
hasCallback = args[1];
|
||||||
|
|
||||||
|
if (isWebViewAvailable && browserWrap && popup) {
|
||||||
|
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
|
||||||
|
var op = popup.invokeScriptAsync("eval", code);
|
||||||
|
op.oncomplete = function () { hasCallback && win([]); };
|
||||||
|
op.onerror = function () { };
|
||||||
|
op.start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = IAB;
|
||||||
|
|
||||||
|
require("cordova/exec/proxy").add("InAppBrowser", module.exports);
|
||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
id="org.apache.cordova.inappbrowser.tests"
|
id="org.apache.cordova.inappbrowser.tests"
|
||||||
version="0.5.2">
|
version="0.5.3">
|
||||||
<name>Cordova InAppBrowser Plugin Tests</name>
|
<name>Cordova InAppBrowser Plugin Tests</name>
|
||||||
<license>Apache 2.0</license>
|
<license>Apache 2.0</license>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user