Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ae4130296 | ||
|
|
32c0e41c43 | ||
|
|
43592a4789 | ||
|
|
4b3a838704 | ||
|
|
ac0bdee8e6 | ||
|
|
22b3f0ccd4 | ||
|
|
6e0ea336fc | ||
|
|
f47f5449c2 | ||
|
|
8ce6b497fa | ||
|
|
df90a6acc4 | ||
|
|
f90e571430 | ||
|
|
ec8c4527b9 | ||
|
|
faf37db5da | ||
|
|
5fc1beed0d | ||
|
|
832ff5f2e9 | ||
|
|
4f957919c7 | ||
|
|
81161ebe66 | ||
|
|
683937872d | ||
|
|
2c018a3460 | ||
|
|
315a0e30db | ||
|
|
69ca780772 | ||
|
|
79f73fbe62 | ||
|
|
c37b08e038 | ||
|
|
0900f5cc62 | ||
|
|
97e0eac603 | ||
|
|
c2c94f315b | ||
|
|
8cb876c63a | ||
|
|
cc2f8966ba | ||
|
|
f620b64035 | ||
|
|
d828197de4 | ||
|
|
6e38667320 | ||
|
|
ea6a4fc80a | ||
|
|
ac9c64964e | ||
|
|
61239c12e8 | ||
|
|
9fe291ce7a | ||
|
|
225bde271b | ||
|
|
e5d07f14e8 | ||
|
|
f866e0ed9f | ||
|
|
ae5e01ef04 | ||
|
|
91b84579e8 | ||
|
|
89ae9dbd53 | ||
|
|
c011fe2d9d | ||
|
|
9fc6654b89 | ||
|
|
1953356fd2 | ||
|
|
687ce60470 | ||
|
|
8e2db096ae | ||
|
|
6b25158e07 | ||
|
|
34653ce393 | ||
|
|
4a3c134be1 | ||
|
|
dbf54d2d09 | ||
|
|
863386398e | ||
|
|
ef9ca5ad3e |
@@ -112,3 +112,35 @@
|
||||
* CB-5649 - InAppBrowser overrides App's orientation
|
||||
* refactoring fixed
|
||||
* CB-6396 [Firefox OS] Adding basic support
|
||||
|
||||
### 0.5.1 (Aug 06, 2014)
|
||||
* ubuntu: support qt 5.2
|
||||
* **FFOS** update InAppBrowserProxy.js
|
||||
* **FFOS** app needs to be privileged
|
||||
* CB-6127 Updated translations for docs
|
||||
* CB-6769 ios: Fix statusbar color reset wasn't working on iOS7+
|
||||
|
||||
### 0.5.2 (Sep 17, 2014)
|
||||
* CB-7471 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
* CB-7490 Fixes InAppBrowser manual tests crash on windows platform
|
||||
* CB-7249 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
* CB-7424 Wrong docs: anchor tags are not supported by the InAppBrowser
|
||||
* CB-7133 clarify that anchor1 doesn't exist
|
||||
* CB-7133 more fixup of tests on Android
|
||||
* CB-7133 fix up the tests for Android
|
||||
* Add just a bit more logging
|
||||
* CB-7133 port inappbrowser to plugin-test-framework
|
||||
* phonegap events supported for \_blank target
|
||||
* inappbrowser \_blank target position is fixed
|
||||
* 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
|
||||
|
||||
@@ -19,41 +19,30 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Dieses Plugin bietet eine Web-Browser-Ansicht, die anzeigt, beim Aufrufen von `window.open()` , oder als als bildeten einen Link öffnen`<a target="_blank">`.
|
||||
Dieses Plugin bietet eine Web-Browser-Ansicht, die beim Aufruf angezeigt`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
|
||||
**Hinweis**: die InAppBrowser Fenster verhält sich wie einen standard-Webbrowser und Cordova APIs kann nicht zugegriffen werden kann.
|
||||
**Hinweis**: Das InAppBrowser Fenster verhält sich wie ein Standard-Webbrowser. Auf die Cordova-API kann in diesem Moment nicht zugegriffen werden!
|
||||
|
||||
## Installation
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox OS
|
||||
|
||||
Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. Fügen Sie die entsprechenden Permisions.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Öffnet eine URL in einem neuen `InAppBrowser` Instanz, die aktuelle Browserinstanz oder der Systembrowser.
|
||||
Öffnet eine URL in einer neuen `InAppBrowser` Instanz, der aktuelle Browserinstanz oder der Systembrowser.
|
||||
|
||||
Var Ref = window.open (Url, Ziel, Optionen);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)*
|
||||
* **Ref**: Bezugnahme auf das `InAppBrowser` Fenster. *(InAppBrowser)*
|
||||
|
||||
* **URL**: die URL *(String)*zu laden. Rufen Sie `encodeURI()` auf diese Option, wenn die URL enthält Unicode-Zeichen.
|
||||
* **URL**: die URL um den *(String)* zu laden. Rufen Sie `encodeURI()` auf, wenn die URL Unicode-Zeichen enthält.
|
||||
|
||||
* **Ziel**: das Ziel in der URL, einen optionalen Parameter geladen, die standardmäßig auf `_self` . *(String)*
|
||||
* **Ziel**: das Ziel in welchem die URL geladen werden soll. Standardmäßig entspricht dieser Wert `_self` . *(String)*
|
||||
|
||||
* `_self`: Öffnet sich in der Cordova WebView wenn der URL in der Whitelist ist, andernfalls es öffnet sich in der`InAppBrowser`.
|
||||
* `_blank`: Öffnet den`InAppBrowser`.
|
||||
@@ -85,18 +74,19 @@ Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. F
|
||||
* **AllowInlineMediaPlayback**: Legen Sie auf `yes` oder `no` Inline-HTML5-Media-Wiedergabe, Darstellung im Browser-Fenster, sondern in eine gerätespezifische Wiedergabe-Schnittstelle ermöglichen. Des HTML `video` Element muss auch die `webkit-playsinline` Attribut (Standard:`no`)
|
||||
* **KeyboardDisplayRequiresUserAction**: Legen Sie auf `yes` oder `no` um die Tastatur zu öffnen, wenn Formularelemente Fokus per JavaScript erhalten `focus()` Anruf (Standard:`yes`).
|
||||
* **SuppressesIncrementalRendering**: Legen Sie auf `yes` oder `no` zu warten, bis alle neuen anzeigen-Inhalte empfangen wird, bevor Sie wiedergegeben wird (standardmäßig`no`).
|
||||
* **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][2] (standardmäßig fest`fullscreen`).
|
||||
* **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][3] (standardmäßig fest`coververtical`).
|
||||
* **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][1] (standardmäßig fest`fullscreen`).
|
||||
* **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][2] (standardmäßig fest`coververtical`).
|
||||
* **Toolbarposition**: Legen Sie auf `top` oder `bottom` (Standard ist `bottom` ). Bewirkt, dass die Symbolleiste am oberen oder unteren Rand des Fensters sein.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### Unterstützte Plattformen
|
||||
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
@@ -106,6 +96,36 @@ Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. F
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS Macken
|
||||
|
||||
Als Plugin jedes Design erzwingen nicht besteht die Notwendigkeit, einige CSS-Regeln hinzuzufügen, wenn bei `target='_blank'` . Die Regeln könnte wie diese aussehen.
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
@@ -206,6 +226,7 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Este plugin proporciona una vista de navegador web que se muestra cuando se llama a `window.open()` , o cuando abre un enlace formado como`<a target="_blank">`.
|
||||
Este plugin proporciona una vista de navegador web que se muestra cuando se llama a`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@ Este plugin proporciona una vista de navegador web que se muestra cuando se llam
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox OS
|
||||
|
||||
Crear **www/manifest.webapp** como se describe en [Manifestar Docs][1]. Agregar permisos pertinentes.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia actual del navegador o el navegador del sistema.
|
||||
|
||||
var ref = window.open (url, target, opciones);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)*
|
||||
@@ -85,18 +74,19 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act
|
||||
* **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. El código de HTML `video` elemento también debe incluir la `webkit-playsinline` atributo (por defecto`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: A `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante JavaScript `focus()` llamada (por defecto`yes`).
|
||||
* **suppressesIncrementalRendering**: A `yes` o `no` que esperar a que todo el contenido nuevo vista es recibido antes de ser prestados (por defecto`no`).
|
||||
* **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][2] (por defecto`fullscreen`).
|
||||
* **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][3] (por defecto`coververtical`).
|
||||
* **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][1] (por defecto`fullscreen`).
|
||||
* **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][2] (por defecto`coververtical`).
|
||||
* **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
@@ -106,6 +96,36 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS rarezas
|
||||
|
||||
Como plugin no cumplir cualquier diseño es necesario añadir algunas reglas CSS si abre con `target='_blank'` . Las reglas pueden parecerse a estos
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
El objeto devuelto desde una llamada a`window.open`.
|
||||
@@ -206,6 +226,7 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
* Amazon fuego OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appelez `window.open()` , ou quand un lien d'ouverture formé comme`<a target="_blank">`.
|
||||
Ce plugin vous offre une vue de navigateur web qui s'affiche lors de l'appel`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@ Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appele
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox OS
|
||||
|
||||
Créez **www/manifest.webapp** comme décrit dans [Les Docs manifeste][1]. Ajouter permisions pertinentes.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateur actuelle ou dans l'Explorateur du système.
|
||||
|
||||
var Réf = window.open (url, cible, options) ;
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)*
|
||||
@@ -68,7 +57,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
Android uniquement :
|
||||
|
||||
* **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
|
||||
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
||||
|
||||
@@ -76,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.
|
||||
* **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
|
||||
* **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`)
|
||||
@@ -85,19 +74,25 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
* **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'HTML `video` élément doit également inclure la `webkit-playsinline` attribut (par défaut,`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: la valeur `yes` ou `no` pour ouvrir le clavier lorsque les éléments reçoivent le focus par l'intermédiaire de JavaScript `focus()` appel (par défaut,`yes`).
|
||||
* **suppressesIncrementalRendering**: la valeur `yes` ou `no` d'attendre que toutes les nouveautés de vue sont reçue avant d'être restitué (par défaut,`no`).
|
||||
* **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][2] (par défaut,`fullscreen`).
|
||||
* **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][3] (par défaut,`coververtical`).
|
||||
* **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`).
|
||||
* **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.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### Plates-formes prises en charge
|
||||
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Exemple
|
||||
@@ -106,6 +101,36 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS Quirks
|
||||
|
||||
Comme plugin n'est pas appliquer n'importe quelle conception il est nécessaire d'ajouter quelques règles CSS si ouvert avec `target='_blank'` . Les règles pourraient ressembler à ces
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
L'objet retourné par un appel à`window.open`.
|
||||
@@ -152,6 +177,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Petit exemple
|
||||
@@ -183,6 +209,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Petit exemple
|
||||
@@ -206,7 +233,9 @@ L'objet retourné par un appel à`window.open`.
|
||||
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Petit exemple
|
||||
@@ -229,6 +258,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
|
||||
### Petit exemple
|
||||
|
||||
@@ -260,6 +290,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
|
||||
### Petit exemple
|
||||
|
||||
|
||||
12
doc/index.md
12
doc/index.md
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
This plugin provides a web browser view that displays when calling `window.open()`, or when opening a link formed as `<a target="_blank">`.
|
||||
This plugin provides a web browser view that displays when calling `window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -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`).
|
||||
- __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
|
||||
|
||||
- Amazon Fire OS
|
||||
@@ -84,6 +88,7 @@ instance, or the system browser.
|
||||
- BlackBerry 10
|
||||
- Firefox OS
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Example
|
||||
@@ -169,6 +174,7 @@ The object returned from a call to `window.open`.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -199,6 +205,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -222,6 +229,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Android
|
||||
- Firefox OS
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -242,6 +250,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
|
||||
### Quick Example
|
||||
|
||||
@@ -273,6 +282,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
|
||||
### Quick Example
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama `window.open()` , o quando un link di apertura formata come`<a target="_blank">`.
|
||||
Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@ Questo plugin fornisce una vista di browser web che viene visualizzata quando si
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox OS
|
||||
|
||||
Creare **www/manifest.webapp** come descritto nel [Manifesto Docs][1]. Aggiungi permisions rilevanti.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser o il browser di sistema.
|
||||
|
||||
rif var = Window. Open (url, destinazione, opzioni);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)*
|
||||
@@ -85,18 +74,19 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser
|
||||
* **allowInlineMediaPlayback**: impostare su `yes` o `no` per consentire la riproduzione dei supporti HTML5 in linea, visualizzare all'interno della finestra del browser, piuttosto che un'interfaccia specifica del dispositivo di riproduzione. L'HTML `video` elemento deve includere anche il `webkit-playsinline` (default di attributo`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: impostare su `yes` o `no` per aprire la tastiera quando elementi form ricevano lo stato attivo tramite di JavaScript `focus()` chiamata (default`yes`).
|
||||
* **suppressesIncrementalRendering**: impostare su `yes` o `no` aspettare fino a quando tutti i nuovi contenuti di vista viene ricevuto prima il rendering (default`no`).
|
||||
* **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][2] (default`fullscreen`).
|
||||
* **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][3] (default`coververtical`).
|
||||
* **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][1] (default`fullscreen`).
|
||||
* **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][2] (default`coververtical`).
|
||||
* **toolbarposition**: impostare su `top` o `bottom` (default è `bottom` ). Provoca la barra degli strumenti sia nella parte superiore o inferiore della finestra.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### Piattaforme supportate
|
||||
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
@@ -106,6 +96,36 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS stranezze
|
||||
|
||||
Come plugin non imporre alcun disegno c'è bisogno di aggiungere alcune regole CSS se aperto con `target='_blank'` . Le regole potrebbero apparire come questi
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
L'oggetto restituito da una chiamata a`window.open`.
|
||||
@@ -206,6 +226,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
このプラグインを呼び出すときに表示される web ブラウザーのビューを提供します `window.open()` 、または時として形成されたリンクを開く`<a target="_blank">`.
|
||||
このプラグインを呼び出すときに表示される web ブラウザーのビューを提供します`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox の OS
|
||||
|
||||
[マニフェストのドキュメント][1]で説明されているように、 **www/manifest.webapp**を作成します。関連する権限を追加します。
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
新しい URL を開き `InAppBrowser` インスタンス、現在のブラウザー インスタンスまたはシステムのブラウザー。
|
||||
|
||||
var ref = window.open url、ターゲット (オプション);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
|
||||
@@ -85,18 +74,19 @@
|
||||
* **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`).
|
||||
* **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`).
|
||||
* **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][2]を設定するには`fullscreen`).
|
||||
* **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][3]を設定するには`coververtical`).
|
||||
* **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][1]を設定するには`fullscreen`).
|
||||
* **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][2]を設定するには`coververtical`).
|
||||
* **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### サポートされているプラットフォーム
|
||||
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* ブラックベリー 10
|
||||
* Firefox の OS
|
||||
* iOS
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
@@ -106,6 +96,36 @@
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS 癖
|
||||
|
||||
開かれた場合にいくつかの CSS ルールを追加する必要があるプラグインは任意のデザインを適用しないよう `target='_blank'` 。これらのような規則になります。
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
呼び出しから返されるオブジェクト`window.open`.
|
||||
@@ -206,6 +226,7 @@
|
||||
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* Firefox の OS
|
||||
* iOS
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
호출할 때 표시 하는 웹 브라우저 보기를 제공 하는이 플러그인 `window.open()` , 또는 때로 형성 된 링크 열기`<a target="_blank">`.
|
||||
이 플러그인은를 호출할 때 표시 하는 웹 브라우저 보기를 제공 합니다.`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox 운영 체제
|
||||
|
||||
[참고 문서][1]에 설명 된 대로 **www/manifest.webapp** 를 만듭니다. 관련 부여할 추가 합니다.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
새 URL을 엽니다 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저.
|
||||
|
||||
var ref = window.open (url, 대상, 옵션);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
|
||||
@@ -85,18 +74,19 @@
|
||||
* **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`).
|
||||
* **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`).
|
||||
* **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][2] (기본값을 설정 하려면`fullscreen`).
|
||||
* **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][3] (기본값을 설정 하려면`coververtical`).
|
||||
* **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][1] (기본값을 설정 하려면`fullscreen`).
|
||||
* **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][2] (기본값을 설정 하려면`coververtical`).
|
||||
* **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### 지원 되는 플랫폼
|
||||
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* 블랙베리 10
|
||||
* Firefox 운영 체제
|
||||
* iOS
|
||||
* Windows Phone 7과 8
|
||||
|
||||
@@ -106,6 +96,36 @@
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### 파이어 폭스 OS 단점
|
||||
|
||||
플러그인 어떤 디자인을 적용 하지 않는 경우 열 일부 CSS의 규칙을 추가할 필요가 있다 `target='_blank'` . 이 같이 규칙
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
호출에서 반환 하는 개체`window.open`.
|
||||
@@ -206,6 +226,7 @@
|
||||
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* Firefox 운영 체제
|
||||
* iOS
|
||||
* Windows Phone 7과 8
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `window.open()` , lub kiedy otwarcie łącza utworzone jako`<a target="_blank">`.
|
||||
Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@ Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywo
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### Firefox OS
|
||||
|
||||
Tworzenie **www/manifest.webapp** , jak opisano w [Dokumentach Manifest][1]. Dodaj odpowiednie permisions.
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglądarki lub przeglądarki systemu.
|
||||
|
||||
var ref = window.open (adres url, docelowy opcje);
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)*
|
||||
@@ -85,18 +74,19 @@ Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglą
|
||||
* **allowInlineMediaPlayback**: zestaw `yes` lub `no` Aby w linii HTML5 odtwarzanie, wyświetlanie w oknie przeglądarki, a nie interfejs odtwarzanie specyficzne dla urządzenia. HTML `video` również musi zawierać element `webkit-playsinline` atrybut (domyślnie`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: zestaw `yes` lub `no` Aby otworzyć klawiaturę ekranową, gdy elementy formularza ostrości za pomocą JavaScript `focus()` połączenia (domyślnie`yes`).
|
||||
* **suppressesIncrementalRendering**: zestaw `yes` lub `no` czekać, aż wszystkie nowe widok zawartości jest otrzymane przed renderowany (domyślnie`no`).
|
||||
* **presentationstyle**: zestaw `pagesheet` , `formsheet` lub `fullscreen` Aby ustawić [styl prezentacji][2] (domyślnie`fullscreen`).
|
||||
* **transitionstyle**: zestaw `fliphorizontal` , `crossdissolve` lub `coververtical` Aby ustawić [styl przejścia][3] (domyślnie`coververtical`).
|
||||
* **presentationstyle**: zestaw `pagesheet` , `formsheet` lub `fullscreen` Aby ustawić [styl prezentacji][1] (domyślnie`fullscreen`).
|
||||
* **transitionstyle**: zestaw `fliphorizontal` , `crossdissolve` lub `coververtical` Aby ustawić [styl przejścia][2] (domyślnie`coververtical`).
|
||||
* **toolbarposition**: zestaw `top` lub `bottom` (domyślnie `bottom` ). Powoduje, że pasek ma być na górze lub na dole okna.
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Android
|
||||
* Jeżyna 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
@@ -106,6 +96,36 @@ Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglą
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS dziwactwa
|
||||
|
||||
Jak plugin nie wymuszać każdy projekt to trzeba dodać pewne reguły CSS jeśli otwarty z `target='_blank'` . Zasady może wyglądać jak te
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
Obiekt zwrócony z wywołania`window.open`.
|
||||
@@ -206,6 +226,7 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
* Amazon ogień OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
|
||||
320
doc/ru/index.md
Normal file
320
doc/ru/index.md
Normal file
@@ -0,0 +1,320 @@
|
||||
<!---
|
||||
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.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Этот плагин обеспечивает представление веб-браузера, что показывает при вызове`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
|
||||
**Примечание**: InAppBrowser окно ведет себя как стандартный веб-браузер и не может доступ API Cordova.
|
||||
|
||||
## Установка
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
Открывает URL-адрес в новом `InAppBrowser` например, текущий экземпляр браузера или браузера системы.
|
||||
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)*
|
||||
|
||||
* **URL**: URL-адрес для загрузки *(String)*. Вызвать `encodeURI()` на это, если URL-адрес содержит символы Unicode.
|
||||
|
||||
* **Цель**: цель для загрузки URL-адреса, необязательный параметр, по умолчанию `_self` . *(Строка)*
|
||||
|
||||
* `_self`: Открывается в Cordova WebView, если URL-адрес в белый список, в противном случае он открывается в`InAppBrowser`.
|
||||
* `_blank`: Открывает в`InAppBrowser`.
|
||||
* `_system`: Открывается в веб-браузера системы.
|
||||
|
||||
* **опции**: параметры для `InAppBrowser` . Необязательный параметр, виновная в: `location=yes` . *(Строка)*
|
||||
|
||||
`options`Строка не должна содержать каких-либо пустое пространство, и каждая функция пар имя/значение должны быть разделены запятой. Функция имена нечувствительны к регистру. Все платформы поддерживают исходное значение:
|
||||
|
||||
* **Расположение**: равным `yes` или `no` превратить `InAppBrowser` в адресную строку или выключить.
|
||||
|
||||
Только андроид:
|
||||
|
||||
* **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** .
|
||||
* **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
|
||||
* **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна
|
||||
* **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна
|
||||
|
||||
только iOS:
|
||||
|
||||
* **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** . Обратите внимание, что вам нужно самостоятельно локализовать это значение.
|
||||
* **disallowoverscroll**: значение `yes` или `no` (по умолчанию `no` ). Включает/отключает свойство UIWebViewBounce.
|
||||
* **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
|
||||
* **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна
|
||||
* **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна
|
||||
* **панели инструментов**: набор `yes` или `no` для включения панели инструментов или выключить InAppBrowser (по умолчанию`yes`)
|
||||
* **enableViewportScale**: значение `yes` или `no` для предотвращения просмотра, масштабирования через тег meta (по умолчанию`no`).
|
||||
* **mediaPlaybackRequiresUserAction**: значение `yes` или `no` для предотвращения HTML5 аудио или видео от Автовоспроизведение (по умолчанию`no`).
|
||||
* **allowInlineMediaPlayback**: значение `yes` или `no` чтобы разрешить воспроизведение мультимедиа HTML5 в строки, отображения в окне браузера, а не конкретного устройства воспроизведения интерфейс. HTML `video` элемент должен также включать `webkit-playsinline` атрибут (по умолчанию`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: значение `yes` или `no` чтобы открыть клавиатуру, когда формы элементы получают фокус через JavaScript в `focus()` вызов (по умолчанию`yes`).
|
||||
* **suppressesIncrementalRendering**: значение `yes` или `no` ждать, пока все новое содержание представление получено до визуализации (по умолчанию`no`).
|
||||
* **presentationstyle**: набор `pagesheet` , `formsheet` или `fullscreen` чтобы задать [стиль презентации][1] (по умолчанию`fullscreen`).
|
||||
* **transitionstyle**: набор `fliphorizontal` , `crossdissolve` или `coververtical` чтобы задать [стиль перехода][2] (по умолчанию`coververtical`).
|
||||
* **toolbarposition**: значение `top` или `bottom` (по умолчанию `bottom` ). Вызывает панели инструментов, чтобы быть в верхней или нижней части окна.
|
||||
|
||||
[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
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 и 8
|
||||
|
||||
### Пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS причуды
|
||||
|
||||
Как плагин не применять любой дизайн есть необходимость добавить некоторые правила CSS, если открыт с `target='_blank'` . Правила может выглядеть как эти
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
Объект, возвращаемый из вызова`window.open`.
|
||||
|
||||
### Методы
|
||||
|
||||
* addEventListener
|
||||
* removeEventListener
|
||||
* close
|
||||
* show
|
||||
* executeScript
|
||||
* insertCSS
|
||||
|
||||
## addEventListener
|
||||
|
||||
> Добавляет прослушиватель для события от`InAppBrowser`.
|
||||
|
||||
ref.addEventListener(eventname, callback);
|
||||
|
||||
|
||||
* **ссылка**: ссылка для `InAppBrowser` окно *(InAppBrowser)*
|
||||
|
||||
* **EventName**: событие для прослушивания *(String)*
|
||||
|
||||
* **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса.
|
||||
* **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса.
|
||||
* **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку при загрузке URL-адреса.
|
||||
* **выход**: возникает событие, когда `InAppBrowser` окно закрыто.
|
||||
|
||||
* **обратного вызова**: функция, которая выполняется, когда возникает событие. Функция передается `InAppBrowserEvent` объект в качестве параметра.
|
||||
|
||||
### InAppBrowserEvent свойства
|
||||
|
||||
* **тип**: eventname, либо `loadstart` , `loadstop` , `loaderror` , или `exit` . *(Строка)*
|
||||
|
||||
* **URL**: URL-адрес, который был загружен. *(Строка)*
|
||||
|
||||
* **код**: код ошибки, только в случае `loaderror` . *(Число)*
|
||||
|
||||
* **сообщение**: сообщение об ошибке, только в случае `loaderror` . *(Строка)*
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* iOS
|
||||
* Windows Phone 7 и 8
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstart', function(event) { alert(event.url); });
|
||||
|
||||
|
||||
## метод removeEventListener
|
||||
|
||||
> Удаляет прослушиватель для события от`InAppBrowser`.
|
||||
|
||||
ref.removeEventListener(eventname, callback);
|
||||
|
||||
|
||||
* **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)*
|
||||
|
||||
* **EventName**: событие прекратить прослушивание. *(Строка)*
|
||||
|
||||
* **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса.
|
||||
* **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса.
|
||||
* **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку загрузки URL-адреса.
|
||||
* **выход**: возникает событие, когда `InAppBrowser` окно закрывается.
|
||||
|
||||
* **обратного вызова**: функция, выполняемая когда это событие наступает. Функция передается `InAppBrowserEvent` объект.
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* iOS
|
||||
* Windows Phone 7 и 8
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
var myCallback = function(event) { alert(event.url); }
|
||||
ref.addEventListener('loadstart', myCallback);
|
||||
ref.removeEventListener('loadstart', myCallback);
|
||||
|
||||
|
||||
## close
|
||||
|
||||
> Закрывает `InAppBrowser` окно.
|
||||
|
||||
Ref.Close();
|
||||
|
||||
|
||||
* **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)*
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows Phone 7 и 8
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.close();
|
||||
|
||||
|
||||
## show
|
||||
|
||||
> Отображается окно InAppBrowser, был открыт скрытые. Вызов это не имеет эффекта при InAppBrowser уже был виден.
|
||||
|
||||
Ref.Show();
|
||||
|
||||
|
||||
* **ссылка**: ссылка на окно (InAppBrowser`InAppBrowser`)
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'hidden=yes');
|
||||
// some time later...
|
||||
ref.show();
|
||||
|
||||
|
||||
## executeScript
|
||||
|
||||
> Вставляет код JavaScript в `InAppBrowser` окно
|
||||
|
||||
ref.executeScript(details, callback);
|
||||
|
||||
|
||||
* **ссылка**: ссылка на `InAppBrowser` окно. *(InAppBrowser)*
|
||||
|
||||
* **injectDetails**: подробности сценария для запуска, указав либо `file` или `code` ключ. *(Объект)*
|
||||
|
||||
* **файл**: URL-адрес сценария вставки.
|
||||
* **код**: текст сценария для вставки.
|
||||
|
||||
* **обратного вызова**: функция, которая выполняет после вводят JavaScript-код.
|
||||
|
||||
* Если введенный скрипт имеет тип `code` , обратный вызов выполняется с одним параметром, который является возвращаемое значение сценария, завернутые в `Array` . Для многострочных сценариев это возвращаемое значение последнего оператора, или последнее вычисленное выражение.
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.executeScript({file: "myscript.js"});
|
||||
});
|
||||
|
||||
|
||||
## insertCSS
|
||||
|
||||
> Внедряет CSS в `InAppBrowser` окно.
|
||||
|
||||
ref.insertCSS(details, callback);
|
||||
|
||||
|
||||
* **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)*
|
||||
|
||||
* **injectDetails**: детали сценария для запуска, указав либо `file` или `code` ключ. *(Объект)*
|
||||
|
||||
* **файл**: URL-адрес таблицы стилей для вставки.
|
||||
* **код**: текст таблицы стилей для вставки.
|
||||
|
||||
* **обратного вызова**: функция, которая выполняет после вводят CSS.
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
### Быстрый пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
這個外掛程式提供了一個 web 瀏覽器視圖,顯示時調用 `window.open()` ,或當打開連結形成的作為`<a target="_blank">`.
|
||||
這個外掛程式提供了一個 web 瀏覽器視圖,顯示在調用時`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -31,22 +31,11 @@
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
|
||||
|
||||
### 火狐瀏覽器作業系統
|
||||
|
||||
在[清單檔][1]中所述創建**www/manifest.webapp** 。添加相關許可權。
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest
|
||||
|
||||
"permissions": {
|
||||
"browser": {}
|
||||
}
|
||||
|
||||
|
||||
## window.open
|
||||
|
||||
在一個新的中打開 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。
|
||||
在一個新打開一個 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。
|
||||
|
||||
var ref = window.open (url、 目標、 選項) ;
|
||||
var ref = window.open(url, target, options);
|
||||
|
||||
|
||||
* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
|
||||
@@ -85,18 +74,19 @@
|
||||
* **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`)
|
||||
* **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`).
|
||||
* **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`).
|
||||
* **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][2](預設為`fullscreen`).
|
||||
* **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][3](預設為`coververtical`).
|
||||
* **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][1](預設為`fullscreen`).
|
||||
* **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][2](預設為`coververtical`).
|
||||
* **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。
|
||||
|
||||
[2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
|
||||
[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
|
||||
|
||||
### 支援的平臺
|
||||
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* 黑莓 10
|
||||
* 火狐瀏覽器的作業系統
|
||||
* iOS
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
@@ -106,6 +96,36 @@
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### 火狐瀏覽器作業系統的怪癖
|
||||
|
||||
外掛程式不會執行任何的設計是需要添加一些 CSS 規則,如果打開的 `target='_blank'` 。規則 》 可能看起來像這些
|
||||
|
||||
css
|
||||
.inAppBrowserWrap {
|
||||
background-color: rgba(0,0,0,0.75);
|
||||
color: rgba(235,235,235,1.0);
|
||||
}
|
||||
.inAppBrowserWrap menu {
|
||||
overflow: auto;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.inAppBrowserWrap menu li {
|
||||
font-size: 25px;
|
||||
height: 25px;
|
||||
float: left;
|
||||
margin: 0 10px;
|
||||
padding: 3px 10px;
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
background: rgba(30,30,30,0.50);
|
||||
}
|
||||
.inAppBrowserWrap menu li.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
從調用返回的物件`window.open`.
|
||||
@@ -206,6 +226,7 @@
|
||||
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* 火狐瀏覽器的作業系統
|
||||
* iOS
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
|
||||
41
plugin.xml
41
plugin.xml
@@ -20,7 +20,7 @@
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser"
|
||||
version="0.5.0">
|
||||
version="0.5.3">
|
||||
|
||||
<name>InAppBrowser</name>
|
||||
<description>Cordova InAppBrowser Plugin</description>
|
||||
@@ -32,7 +32,7 @@
|
||||
<engines>
|
||||
<engine name="cordova" version=">=3.1.0" /><!-- Needs cordova/urlutil -->
|
||||
</engines>
|
||||
|
||||
|
||||
<!-- android -->
|
||||
<platform name="android">
|
||||
<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" />
|
||||
|
||||
</platform>
|
||||
|
||||
|
||||
<!-- amazon-fireos -->
|
||||
<platform name="amazon-fireos">
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
@@ -78,9 +78,26 @@
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/amazon/InAppBrowser.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
<source-file src="src/android/InAppBrowserDialog.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
<source-file src="src/amazon/InAppChromeClient.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
|
||||
<!-- drawable src/android/resources -->
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_next_item.png" target="res/drawable-hdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_next_item.png" target="res/drawable-mdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_next_item.png" target="res/drawable-xhdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_next_item.png" target="res/drawable-xxhdpi/ic_action_next_item.png" />
|
||||
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_previous_item.png" target="res/drawable-hdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_previous_item.png" target="res/drawable-mdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_previous_item.png" target="res/drawable-xhdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_previous_item.png" target="res/drawable-xxhdpi/ic_action_previous_item.png" />
|
||||
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_remove.png" target="res/drawable-hdpi/ic_action_remove.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_remove.png" target="res/drawable-mdpi/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" />
|
||||
</platform>
|
||||
|
||||
|
||||
<!-- ubuntu -->
|
||||
<platform name="ubuntu">
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
@@ -162,11 +179,21 @@
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
</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 -->
|
||||
<platform name="firefoxos">
|
||||
<config-file target="config.xml" parent="/*">
|
||||
<permission name="browser" description="Enables the app to implement a browser in an iframe." />
|
||||
<permission name="browser" description="Enables the app to implement a browser in an iframe." privileged="true"/>
|
||||
</config-file>
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
<clobbers target="window.open" />
|
||||
@@ -174,6 +201,6 @@
|
||||
<js-module src="src/firefoxos/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
</platform>
|
||||
</platform>
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
package org.apache.cordova.inappbrowser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import org.apache.cordova.inappbrowser.InAppBrowserDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
@@ -82,7 +85,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private static final String CLEAR_ALL_CACHE = "clearcache";
|
||||
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
|
||||
|
||||
private Dialog dialog;
|
||||
private InAppBrowserDialog dialog;
|
||||
private AmazonWebView inAppWebView;
|
||||
private EditText edittext;
|
||||
private CallbackContext callbackContext;
|
||||
@@ -256,11 +259,16 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
scriptToInject = source;
|
||||
}
|
||||
final String finalScriptToInject = scriptToInject;
|
||||
// This action will have the side-effect of blurring the currently focused element
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void run() {
|
||||
inAppWebView.loadUrl("javascript:" + finalScriptToInject);
|
||||
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);
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -305,7 +313,14 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
try {
|
||||
Intent intent = null;
|
||||
intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
// Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
|
||||
// Adding the MIME type to http: URLs causes them to not be handled by the downloader.
|
||||
Uri uri = Uri.parse(url);
|
||||
if ("file".equals(uri.getScheme())) {
|
||||
intent.setDataAndType(uri, webView.getResourceApi().getMimeType(uri));
|
||||
} else {
|
||||
intent.setData(uri);
|
||||
}
|
||||
this.cordova.getActivity().startActivity(intent);
|
||||
return "";
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
@@ -318,16 +333,38 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
* Closes the dialog
|
||||
*/
|
||||
public void closeDialog() {
|
||||
final AmazonWebView childView = this.inAppWebView;
|
||||
// The JS protects against multiple calls, so this should happen only when
|
||||
// closeDialog() is called by other native code.
|
||||
if (childView == null) {
|
||||
return;
|
||||
}
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
childView.setWebViewClient(new AmazonWebViewClient() {
|
||||
// NB: wait for about:blank before dismissing
|
||||
public void onPageFinished(AmazonWebView view, String url) {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
// NB: From SDK 19: "If you call methods on WebView from any thread
|
||||
// other than your app's UI thread, it can cause unexpected results."
|
||||
// http://developer.android.com/guide/webapps/migrating.html#Threads
|
||||
childView.loadUrl("about:blank");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("type", EXIT_EVENT);
|
||||
sendUpdate(obj, false);
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if it is possible to go back one page in history, then does so.
|
||||
*/
|
||||
@@ -385,6 +422,10 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return this.showLocationBar;
|
||||
}
|
||||
|
||||
private InAppBrowser getInAppBrowser(){
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a new browser with the specified URL.
|
||||
*
|
||||
@@ -435,15 +476,11 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
|
||||
public void run() {
|
||||
// Let's create the main dialog
|
||||
dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
dialog.setInAppBroswer(getInAppBrowser());
|
||||
|
||||
// Main container layout
|
||||
LinearLayout main = new LinearLayout(cordova.getActivity());
|
||||
@@ -472,7 +509,21 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
back.setLayoutParams(backLayoutParams);
|
||||
back.setContentDescription("Back Button");
|
||||
back.setId(2);
|
||||
back.setText("<");
|
||||
/*
|
||||
back.setText("<");
|
||||
*/
|
||||
Resources activityRes = cordova.getActivity().getResources();
|
||||
int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable backIcon = activityRes.getDrawable(backResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
back.setBackgroundDrawable(backIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
back.setBackground(backIcon);
|
||||
}
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goBack();
|
||||
@@ -486,7 +537,17 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
forward.setLayoutParams(forwardLayoutParams);
|
||||
forward.setContentDescription("Forward Button");
|
||||
forward.setId(3);
|
||||
forward.setText(">");
|
||||
//forward.setText(">");
|
||||
int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable fwdIcon = activityRes.getDrawable(fwdResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
forward.setBackgroundDrawable(fwdIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
forward.setBackground(fwdIcon);
|
||||
}
|
||||
forward.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goForward();
|
||||
@@ -523,7 +584,17 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
close.setLayoutParams(closeLayoutParams);
|
||||
forward.setContentDescription("Close Button");
|
||||
close.setId(5);
|
||||
close.setText(buttonLabel);
|
||||
//close.setText(buttonLabel);
|
||||
int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable closeIcon = activityRes.getDrawable(closeResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
close.setBackgroundDrawable(closeIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
close.setBackground(closeIcon);
|
||||
}
|
||||
close.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
closeDialog();
|
||||
|
||||
@@ -120,21 +120,24 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// load in webview
|
||||
if (url.startsWith("file://") || url.startsWith("javascript:")
|
||||
|| Config.isUrlWhiteListed(url)) {
|
||||
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");
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
intent.setData(Uri.parse(url));
|
||||
cordova.getActivity().startActivity(intent);
|
||||
cordova.getActivity().startActivity(intent);
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
// load in InAppBrowser
|
||||
else {
|
||||
Log.d(LOG_TAG, "loading in InAppBrowser");
|
||||
result = showWebPage(url, features);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ var IABExecs = {
|
||||
if (browserWrap) {
|
||||
browserWrap.parentNode.removeChild(browserWrap);
|
||||
browserWrap = null;
|
||||
if (typeof(win) == "function") win({type:'exit'});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -71,6 +72,7 @@ var IABExecs = {
|
||||
function updateIframeSizeNoLocation() {
|
||||
browserWrap.style.width = window.innerWidth + 'px';
|
||||
browserWrap.style.height = window.innerHeight + 'px';
|
||||
browserWrap.style.zIndex = '999999999';
|
||||
browserWrap.browser.style.height = (window.innerHeight - 60) + 'px';
|
||||
browserWrap.browser.style.width = browserWrap.style.width;
|
||||
}
|
||||
@@ -91,7 +93,8 @@ var IABExecs = {
|
||||
browserWrap.browser = browserElem;
|
||||
|
||||
browserWrap.classList.add('inAppBrowserWrap');
|
||||
browserWrap.style.position = 'absolute';
|
||||
// position fixed so that it works even when page is scrolled
|
||||
browserWrap.style.position = 'fixed';
|
||||
browserElem.style.position = 'absolute';
|
||||
browserElem.style.border = 0;
|
||||
browserElem.style.top = '60px';
|
||||
@@ -135,7 +138,7 @@ var IABExecs = {
|
||||
|
||||
close.addEventListener('click', function () {
|
||||
setTimeout(function () {
|
||||
IABExecs.close();
|
||||
IABExecs.close(win, lose);
|
||||
}, 0);
|
||||
}, false);
|
||||
|
||||
@@ -154,6 +157,23 @@ var IABExecs = {
|
||||
browserWrap.appendChild(menu);
|
||||
browserWrap.appendChild(browserElem);
|
||||
document.body.appendChild(browserWrap);
|
||||
|
||||
//we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url
|
||||
browserElem.addEventListener('mozbrowserlocationchange', function(e){
|
||||
win({
|
||||
type:'loadstart',
|
||||
url : e.detail
|
||||
})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowserloadend', function(e){
|
||||
win({type:'loadstop'})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowsererror', function(e){
|
||||
win({type:'loaderror'})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowserclose', function(e){
|
||||
win({type:'exit'})
|
||||
}, false);
|
||||
} else {
|
||||
window.location = strUrl;
|
||||
}
|
||||
@@ -168,4 +188,4 @@ var IABExecs = {
|
||||
|
||||
module.exports = IABExecs;
|
||||
|
||||
require('cordova/firefoxos/commandProxy').add('InAppBrowser', module.exports);
|
||||
require('cordova/exec/proxy').add('InAppBrowser', module.exports);
|
||||
|
||||
@@ -440,11 +440,11 @@
|
||||
// Also - this is required for the PDF/User-Agent bug work-around.
|
||||
self.inAppBrowserViewController = nil;
|
||||
|
||||
_previousStatusBarStyle = -1;
|
||||
|
||||
if (IsAtLeastiOSVersion(@"7.0")) {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle];
|
||||
}
|
||||
|
||||
_previousStatusBarStyle = -1; // this value was reset before reapplying it. caused statusbar to stay black on ios7
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,7 +31,7 @@ Inappbrowser::Inappbrowser(Cordova *cordova): CPlugin(cordova), _eventCb(0) {
|
||||
}
|
||||
|
||||
const char code[] = "\
|
||||
var component, object; \
|
||||
var component; \
|
||||
function createObject() { \
|
||||
component = Qt.createComponent(%1); \
|
||||
if (component.status == Component.Ready) \
|
||||
@@ -40,7 +40,7 @@ function createObject() { \
|
||||
component.statusChanged.connect(finishCreation); \
|
||||
} \
|
||||
function finishCreation() { \
|
||||
CordovaWrapper.object = component.createObject(root, \
|
||||
CordovaWrapper.global.inappbrowser = component.createObject(root, \
|
||||
{root: root, cordova: cordova, url1: %2}); \
|
||||
} \
|
||||
createObject()";
|
||||
@@ -50,45 +50,43 @@ const char LOADSTART_EVENT[] = "'loadstart'";
|
||||
const char LOADSTOP_EVENT[] = "'loadstop'";
|
||||
const char LOADERROR_EVENT[] = "'loaderror'";
|
||||
|
||||
void Inappbrowser::open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures) {
|
||||
void Inappbrowser::open(int cb, int, const QString &url, const QString &, const QString &) {
|
||||
assert(_eventCb == 0);
|
||||
|
||||
_eventCb = cb;
|
||||
|
||||
QString path = m_cordova->get_app_dir() + "/../qml/InAppBrowser.qml";
|
||||
|
||||
// TODO: relative url
|
||||
QString qml = QString(code)
|
||||
.arg(CordovaInternal::format(path)).arg(CordovaInternal::format(url));
|
||||
m_cordova->execQML(qml);
|
||||
}
|
||||
|
||||
void Inappbrowser::show(int, int) {
|
||||
m_cordova->execQML("CordovaWrapper.object.visible = true");
|
||||
m_cordova->execQML("CordovaWrapper.global.inappbrowser.visible = true");
|
||||
}
|
||||
|
||||
void Inappbrowser::close(int, int) {
|
||||
m_cordova->execQML("CordovaWrapper.object.destroy()");
|
||||
m_cordova->execQML("CordovaWrapper.global.inappbrowser.destroy()");
|
||||
this->callbackWithoutRemove(_eventCb, EXIT_EVENT);
|
||||
_eventCb = 0;
|
||||
}
|
||||
|
||||
void Inappbrowser::injectStyleFile(int cb, int, const QString&, bool) {
|
||||
void Inappbrowser::injectStyleFile(int, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
void Inappbrowser::injectStyleCode(int cb, int, const QString&, bool) {
|
||||
void Inappbrowser::injectStyleCode(int, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
void Inappbrowser::injectScriptFile(int cb, int, const QString&, bool) {
|
||||
void Inappbrowser::injectScriptFile(int, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
void Inappbrowser::injectScriptCode(int cb, int, const QString&, bool) {
|
||||
void Inappbrowser::injectScriptCode(int, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
158
src/windows/InAppBrowserProxy.js
Normal file
158
src/windows/InAppBrowserProxy.js
Normal file
@@ -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);
|
||||
31
tests/plugin.xml
Normal file
31
tests/plugin.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser.tests"
|
||||
version="0.5.3">
|
||||
<name>Cordova InAppBrowser Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<js-module src="tests.js" name="tests">
|
||||
</js-module>
|
||||
|
||||
<asset src="resources" target="cdvtests/iab-resources" />
|
||||
</plugin>
|
||||
21
tests/resources/inject.css
Normal file
21
tests/resources/inject.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#style-update-file {
|
||||
display: block !important;
|
||||
}
|
||||
44
tests/resources/inject.html
Normal file
44
tests/resources/inject.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>Cordova Mobile Spec</title>
|
||||
<link rel="stylesheet" href="../../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
</head>
|
||||
<body id="stage" class="theme">
|
||||
<h1 id="header">InAppBrowser - Script / Style Injection Test</h1>
|
||||
<h2 id="style-update-file" style="display:none">Style updated from file</h2>
|
||||
<h2 id="style-update-literal" style="display:none">Style updated from literal</h2>
|
||||
<div>User-Agent: <cite id="u-a"></cite></div>
|
||||
</body>
|
||||
<script>
|
||||
function updateUserAgent() {
|
||||
document.getElementById("u-a").textContent = navigator.userAgent;
|
||||
}
|
||||
updateUserAgent();
|
||||
window.setInterval(updateUserAgent, 1500);
|
||||
</script>
|
||||
</html>
|
||||
20
tests/resources/inject.js
Normal file
20
tests/resources/inject.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
var d = document.getElementById("header")
|
||||
d.innerHTML = "Script file successfully injected";
|
||||
67
tests/resources/local.html
Normal file
67
tests/resources/local.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>IAB test page</title>
|
||||
<script type="text/javascript" charset="utf-8" src="../../cordova-incl.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
function onDeviceReady() {
|
||||
document.getElementById("hint").textContent = "Running CordovaWebView, deviceVersion=" + device.version + ", no toolbar should be present, Back link should work, logcat should NOT have failed 'gap:' calls.";
|
||||
}
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
</script>
|
||||
<style>
|
||||
body {background-color: #ffffff;}
|
||||
</style>
|
||||
</head>
|
||||
<body id="stage" class="theme">
|
||||
<h1>Local URL</h1>
|
||||
<div id="info">
|
||||
You have successfully loaded a local URL:
|
||||
<script>document.write(location.href)</script>
|
||||
</div>
|
||||
<hr />
|
||||
<div>User-Agent = <span id="u-a"></span></div>
|
||||
<hr />
|
||||
<div id="hint">Likely running inAppBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.</div>
|
||||
<hr />
|
||||
<div><a href="http://www.google.com">Visit Google</a> (whitelisted)</div>
|
||||
<div><a href="http://www.yahoo.com">Visit Yahoo</a> (not whitelisted)</div>
|
||||
<div><a href="http://www.stluciadance.com/prospectus_file/sample.pdf">Check out my remote PDF</a></div>
|
||||
<div><a href="local.pdf">Check out my local PDF</a></div>
|
||||
<p /><a href="javascript:;" onclick="history.back();">Back</a>
|
||||
<p />
|
||||
<a name="anchor2"></a>
|
||||
<div style="height: 1000px;border:1px solid red;">tall div with border</div>
|
||||
</body>
|
||||
<script>
|
||||
function updateUserAgent() {
|
||||
document.getElementById("u-a").textContent = navigator.userAgent;
|
||||
}
|
||||
updateUserAgent();
|
||||
window.setInterval(updateUserAgent, 1500);
|
||||
</script>
|
||||
</html>
|
||||
BIN
tests/resources/local.pdf
Normal file
BIN
tests/resources/local.pdf
Normal file
Binary file not shown.
42
tests/resources/video.html
Normal file
42
tests/resources/video.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>Cordova Mobile Spec</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<video width=100% height=100% id="player">
|
||||
<source src="http://m.comptoir-info.com/app/beta/sample.mp4">
|
||||
<meta property="og:video:secure_url" content="http://m.comptoir-info.com/app/beta/sample.mp4">
|
||||
<meta property="og:video:type" content="video/mp4">
|
||||
</video>
|
||||
<div>
|
||||
<button onclick="document.getElementById('player').play()"> play </button>
|
||||
<button onclick="document.getElementById('player').pause()"> pause </button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
468
tests/tests.js
Normal file
468
tests/tests.js
Normal file
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
function doOpen(url, target, params, numExpectedRedirects) {
|
||||
numExpectedRedirects = numExpectedRedirects || 0;
|
||||
console.log("Opening " + url);
|
||||
var iab = window.open(url, target, params);
|
||||
if (!iab) {
|
||||
alert('window.open returned ' + iab);
|
||||
return;
|
||||
}
|
||||
var counts;
|
||||
var lastLoadStartURL;
|
||||
var wasReset = false;
|
||||
function reset() {
|
||||
counts = {
|
||||
'loaderror': 0,
|
||||
'loadstart': 0,
|
||||
'loadstop': 0,
|
||||
'exit': 0
|
||||
};
|
||||
lastLoadStartURL = '';
|
||||
}
|
||||
reset();
|
||||
|
||||
function logEvent(e) {
|
||||
console.log('IAB event=' + JSON.stringify(e));
|
||||
counts[e.type]++;
|
||||
// Verify that event.url gets updated on redirects.
|
||||
if (e.type == 'loadstart') {
|
||||
if (e.url == lastLoadStartURL) {
|
||||
alert('Unexpected: loadstart fired multiple times for the same URL.');
|
||||
}
|
||||
lastLoadStartURL = e.url;
|
||||
}
|
||||
// Verify the right number of loadstart events were fired.
|
||||
if (e.type == 'loadstop' || e.type == 'loaderror') {
|
||||
if (e.url != lastLoadStartURL) {
|
||||
alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url');
|
||||
}
|
||||
if (numExpectedRedirects === 0 && counts['loadstart'] !== 1) {
|
||||
// Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL).
|
||||
if (!(e.type == 'loaderror' && counts['loadstart'] === 0)) {
|
||||
alert('Unexpected: got multiple loadstart events. (' + counts['loadstart'] + ')');
|
||||
}
|
||||
} else if (numExpectedRedirects > 0 && counts['loadstart'] < (numExpectedRedirects + 1)) {
|
||||
alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts['loadstart']);
|
||||
}
|
||||
wasReset = true;
|
||||
numExpectedRedirects = 0;
|
||||
reset();
|
||||
}
|
||||
// Verify that loadend / loaderror was called.
|
||||
if (e.type == 'exit') {
|
||||
var numStopEvents = counts['loadstop'] + counts['loaderror'];
|
||||
if (numStopEvents === 0 && !wasReset) {
|
||||
alert('Unexpected: browser closed without a loadstop or loaderror.')
|
||||
} else if (numStopEvents > 1) {
|
||||
alert('Unexpected: got multiple loadstop/loaderror events.');
|
||||
}
|
||||
}
|
||||
}
|
||||
iab.addEventListener('loaderror', logEvent);
|
||||
iab.addEventListener('loadstart', logEvent);
|
||||
iab.addEventListener('loadstop', logEvent);
|
||||
iab.addEventListener('exit', logEvent);
|
||||
|
||||
return iab;
|
||||
}
|
||||
|
||||
function openWithStyle(url, cssUrl, useCallback) {
|
||||
var iab = doOpen(url, '_blank', 'location=yes');
|
||||
var callback = function (results) {
|
||||
if (results && results.length === 0) {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
};
|
||||
if (cssUrl) {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.insertCSS({ file: cssUrl }, useCallback && callback);
|
||||
});
|
||||
} else {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.insertCSS({ code: '#style-update-literal { \ndisplay: block !important; \n}' },
|
||||
useCallback && callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openWithScript(url, jsUrl, useCallback) {
|
||||
var iab = doOpen(url, '_blank', 'location=yes');
|
||||
if (jsUrl) {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.executeScript({ file: jsUrl }, useCallback && function (results) {
|
||||
if (results && results.length === 0) {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
var code = '(function(){\n' +
|
||||
' var header = document.getElementById("header");\n' +
|
||||
' header.innerHTML = "Script literal successfully injected";\n' +
|
||||
' return "abc";\n' +
|
||||
'})()';
|
||||
iab.executeScript({ code: code }, useCallback && function (results) {
|
||||
if (results && results.length === 1 && results[0] === 'abc') {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
var hiddenwnd = null;
|
||||
var loadlistener = function (event) { alert('background window loaded '); };
|
||||
function openHidden(url, startHidden) {
|
||||
var shopt = (startHidden) ? 'hidden=yes' : '';
|
||||
hiddenwnd = window.open(url, 'random_string', shopt);
|
||||
if (!hiddenwnd) {
|
||||
alert('window.open returned ' + hiddenwnd);
|
||||
return;
|
||||
}
|
||||
if (startHidden) hiddenwnd.addEventListener('loadstop', loadlistener);
|
||||
}
|
||||
function showHidden() {
|
||||
if (!!hiddenwnd) {
|
||||
hiddenwnd.show();
|
||||
}
|
||||
}
|
||||
function closeHidden() {
|
||||
if (!!hiddenwnd) {
|
||||
hiddenwnd.removeEventListener('loadstop', loadlistener);
|
||||
hiddenwnd.close();
|
||||
hiddenwnd = null;
|
||||
}
|
||||
}
|
||||
|
||||
var info_div = '<h1>InAppBrowser</h1>' +
|
||||
'<div id="info">' +
|
||||
'Make sure http://www.google.com and https://www.google.com are white listed. </br>' +
|
||||
'Make sure http://www.apple.com is not in the white list.</br>' +
|
||||
'In iOS, starred <span style="vertical-align:super">*</span> tests will put the app in a state with no way to return. </br>' +
|
||||
'<h4>User-Agent: <span id="user-agent"> </span></hr>' +
|
||||
'</div>';
|
||||
|
||||
var local_tests = '<h1>Local URL</h1>' +
|
||||
'<div id="openLocal"></div>' +
|
||||
'Expected result: opens successfully in CordovaWebView.' +
|
||||
'<p/> <div id="openLocalSelf"></div>' +
|
||||
'Expected result: opens successfully in CordovaWebView.' +
|
||||
'<p/> <div id="openLocalSystem"></div>' +
|
||||
'Expected result: fails to open' +
|
||||
'<p/> <div id="openLocalBlank"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar at top.' +
|
||||
'<p/> <div id="openLocalRandomNoLocation"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser without locationBar.' +
|
||||
'<p/> <div id="openLocalRandomToolBarBottom"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the bottom.' +
|
||||
'<p/> <div id="openLocalRandomToolBarTop"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the top.' +
|
||||
'<p/><div id="openLocalRandomToolBarTopNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with no locationBar. On iOS the toolbar is at the top.';
|
||||
|
||||
var white_listed_tests = '<h1>White Listed URL</h1>' +
|
||||
'<div id="openWhiteListed"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com with no location bar.';
|
||||
|
||||
var non_white_listed_tests = '<h1>Non White Listed URL</h1>' +
|
||||
'<div id="openNonWhiteListed"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' +
|
||||
'<p/> <div id="openNonWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' +
|
||||
'<p/> <div id="openNonWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com without locationBar.';
|
||||
|
||||
var page_with_redirects_tests = '<h1>Page with redirect</h1>' +
|
||||
'<div id="openRedirect301"></div>' +
|
||||
'Expected result: should 301 and open successfully in InAppBrowser to www.google.com.' +
|
||||
'<p/> <div id="openRedirect302"></div>' +
|
||||
'Expected result: should 302 and open successfully in InAppBrowser to www.zhihu.com/answer/16714076.';
|
||||
|
||||
var pdf_url_tests = '<h1>PDF URL</h1>' +
|
||||
'<div id="openPDF"></div>' +
|
||||
'Expected result: InAppBrowser opens. PDF should render on iOS.' +
|
||||
'<p/> <div id="openPDFBlank"></div>' +
|
||||
'Expected result: InAppBrowser opens. PDF should render on iOS.';
|
||||
|
||||
var invalid_url_tests = '<h1>Invalid URL</h1>' +
|
||||
'<div id="openInvalidScheme"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser.' +
|
||||
'<p/> <div id="openInvalidHost"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser.' +
|
||||
'<p/> <div id="openInvalidMissing"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser (404).';
|
||||
|
||||
var css_js_injection_tests = '<h1>CSS / JS Injection</h1>' +
|
||||
'<div id="openOriginalDocument"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser without text "Style updated from..."' +
|
||||
'<p/> <div id="openCSSInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from file".' +
|
||||
'<p/> <div id="openCSSInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from file", and alert dialog with text "Results verified".' +
|
||||
'<p/> <div id="openCSSLiteralInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from literal".' +
|
||||
'<p/> <div id="openCSSLiteralInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from literal", and alert dialog with text "Results verified".' +
|
||||
'<p/> <div id="openScriptInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with text "Script file successfully injected".' +
|
||||
'<p/> <div id="openScriptInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with text "Script file successfully injected" and alert dialog with the text "Results verified".' +
|
||||
'<p/> <div id="openScriptLiteralInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" .' +
|
||||
'<p/> <div id="openScriptLiteralInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" and alert dialog with the text "Results verified".';
|
||||
|
||||
var open_hidden_tests = '<h1>Open Hidden </h1>' +
|
||||
'<div id="openHidden"></div>' +
|
||||
'Expected result: no additional browser window. Alert appears with the text "background window loaded".' +
|
||||
'<p/> <div id="showHidden"></div>' +
|
||||
'Expected result: after first clicking on previous test "create hidden", open successfully in InAppBrowser to google.com.' +
|
||||
'<p/> <div id="closeHidden"></div>' +
|
||||
'Expected result: no output. But click on "show hidden" again and nothing should be shown.' +
|
||||
'<p/> <div id="openHiddenShow"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com';
|
||||
|
||||
var clearing_cache_tests = '<h1>Clearing Cache</h1>' +
|
||||
'<div id="openClearCache"></div>' +
|
||||
'Expected result: ?' +
|
||||
'<p/> <div id="openClearSessionCache"></div>' +
|
||||
'Expected result: ?';
|
||||
|
||||
var video_tag_tests = '<h1>Video tag</h1>' +
|
||||
'<div id="openRemoteVideo"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with an embedded video that works after clicking the "play" button.';
|
||||
|
||||
var local_with_anchor_tag_tests = '<h1>Local with anchor tag</h1>' +
|
||||
'<div id="openAnchor1"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to the local page, scrolled to the top as normal.' +
|
||||
'<p/> <div id="openAnchor2"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to the local page, scrolled to the beginning of the tall div with border.';
|
||||
|
||||
// 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;
|
||||
});
|
||||
} 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;
|
||||
}
|
||||
|
||||
document.getElementById("user-agent").textContent = navigator.userAgent;
|
||||
|
||||
// we are already in cdvtests directory
|
||||
var basePath = 'iab-resources/';
|
||||
var localhtml = basePath + 'local.html',
|
||||
localpdf = basePath + 'local.pdf',
|
||||
injecthtml = basePath + 'inject.html',
|
||||
injectjs = 'inject.js',
|
||||
injectcss = 'inject.css',
|
||||
videohtml = basePath + 'video.html';
|
||||
|
||||
//Local
|
||||
createActionButton('target=Default', function () {
|
||||
doOpen(localhtml);
|
||||
}, 'openLocal');
|
||||
createActionButton('target=_self', function () {
|
||||
doOpen(localhtml, '_self');
|
||||
}, 'openLocalSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen(localhtml, '_system');
|
||||
}, 'openLocalSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen(localhtml, '_blank');
|
||||
}, 'openLocalBlank');
|
||||
createActionButton('target=Random, location=no, disallowoverscroll=yes', function () {
|
||||
doOpen(localhtml, 'random_string', 'location=no, disallowoverscroll=yes');
|
||||
}, 'openLocalRandomNoLocation');
|
||||
createActionButton('target=Random, toolbarposition=bottom', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=bottom');
|
||||
}, 'openLocalRandomToolBarBottom');
|
||||
createActionButton('target=Random, toolbarposition=top', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=top');
|
||||
}, 'openLocalRandomToolBarTop');
|
||||
createActionButton('target=Random, toolbarposition=top, location=no', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=top,location=no');
|
||||
}, 'openLocalRandomToolBarTopNoLocation');
|
||||
|
||||
//White Listed
|
||||
createActionButton('* target=Default', function () {
|
||||
doOpen('https://www.google.com');
|
||||
}, 'openWhiteListed');
|
||||
createActionButton('* target=_self', function () {
|
||||
doOpen('https://www.google.com', '_self');
|
||||
}, 'openWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('https://www.google.com', '_system');
|
||||
}, 'openWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('https://www.google.com', '_blank');
|
||||
}, 'openWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('https://www.google.com', 'random_string');
|
||||
}, 'openWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('https://www.google.com', 'random_string', 'location=no');
|
||||
}, 'openWhiteListedRandomNoLocation');
|
||||
|
||||
//Non White Listed
|
||||
createActionButton('target=Default', function () {
|
||||
doOpen('http://www.apple.com');
|
||||
}, 'openNonWhiteListed');
|
||||
createActionButton('target=_self', function () {
|
||||
doOpen('http://www.apple.com', '_self');
|
||||
}, 'openNonWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('http://www.apple.com', '_system');
|
||||
}, 'openNonWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('http://www.apple.com', '_blank');
|
||||
}, 'openNonWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('http://www.apple.com', 'random_string');
|
||||
}, 'openNonWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('http://www.apple.com', 'random_string', 'location=no');
|
||||
}, 'openNonWhiteListedRandomNoLocation');
|
||||
|
||||
//Page with redirect
|
||||
createActionButton('http://google.com', function () {
|
||||
doOpen('http://google.com', 'random_string', '', 1);
|
||||
}, 'openRedirect301');
|
||||
createActionButton('http://goo.gl/pUFqg', function () {
|
||||
doOpen('http://goo.gl/pUFqg', 'random_string', '', 2);
|
||||
}, 'openRedirect302');
|
||||
|
||||
//PDF URL
|
||||
createActionButton('Remote URL', function () {
|
||||
doOpen('http://www.stluciadance.com/prospectus_file/sample.pdf');
|
||||
}, 'openPDF');
|
||||
createActionButton('Local URL', function () {
|
||||
doOpen(localpdf, '_blank');
|
||||
}, 'openPDFBlank');
|
||||
|
||||
//Invalid URL
|
||||
createActionButton('Invalid Scheme', function () {
|
||||
doOpen('x-ttp://www.invalid.com/', '_blank');
|
||||
}, 'openInvalidScheme');
|
||||
createActionButton('Invalid Host', function () {
|
||||
doOpen('http://www.inv;alid.com/', '_blank');
|
||||
}, 'openInvalidHost');
|
||||
createActionButton('Missing Local File', function () {
|
||||
doOpen('nonexistent.html', '_blank');
|
||||
}, 'openInvalidMissing');
|
||||
|
||||
//CSS / JS injection
|
||||
createActionButton('Original Document', function () {
|
||||
doOpen(injecthtml, '_blank');
|
||||
}, 'openOriginalDocument');
|
||||
createActionButton('CSS File Injection', function () {
|
||||
openWithStyle(injecthtml, injectcss);
|
||||
}, 'openCSSInjection');
|
||||
createActionButton('CSS File Injection (callback)', function () {
|
||||
openWithStyle(injecthtml, injectcss, true);
|
||||
}, 'openCSSInjectionCallback');
|
||||
createActionButton('CSS Literal Injection', function () {
|
||||
openWithStyle(injecthtml);
|
||||
}, 'openCSSLiteralInjection');
|
||||
createActionButton('CSS Literal Injection (callback)', function () {
|
||||
openWithStyle(injecthtml, null, true);
|
||||
}, 'openCSSLiteralInjectionCallback');
|
||||
createActionButton('Script File Injection', function () {
|
||||
openWithScript(injecthtml, injectjs);
|
||||
}, 'openScriptInjection');
|
||||
createActionButton('Script File Injection (callback)', function () {
|
||||
openWithScript(injecthtml, injectjs, true);
|
||||
}, 'openScriptInjectionCallback');
|
||||
createActionButton('Script Literal Injection', function () {
|
||||
openWithScript(injecthtml);
|
||||
}, 'openScriptLiteralInjection');
|
||||
createActionButton('Script Literal Injection (callback)', function () {
|
||||
openWithScript(injecthtml, null, true);
|
||||
}, 'openScriptLiteralInjectionCallback');
|
||||
|
||||
//Open hidden
|
||||
createActionButton('Create Hidden', function () {
|
||||
openHidden('https://www.google.com', true);
|
||||
}, 'openHidden');
|
||||
createActionButton('Show Hidden', function () {
|
||||
showHidden();
|
||||
}, 'showHidden');
|
||||
createActionButton('Close Hidden', function () {
|
||||
closeHidden();
|
||||
}, 'closeHidden');
|
||||
createActionButton('google.com Not Hidden', function () {
|
||||
openHidden('https://www.google.com', false);
|
||||
}, 'openHiddenShow');
|
||||
|
||||
//Clearing cache
|
||||
createActionButton('Clear Browser Cache', function () {
|
||||
doOpen('https://www.google.com', '_blank', 'clearcache=yes');
|
||||
}, 'openClearCache');
|
||||
createActionButton('Clear Session Cache', function () {
|
||||
doOpen('https://www.google.com', '_blank', 'clearsessioncache=yes');
|
||||
}, 'openClearSessionCache');
|
||||
|
||||
//Video tag
|
||||
createActionButton('Remote Video', function () {
|
||||
doOpen(videohtml, '_blank');
|
||||
}, 'openRemoteVideo');
|
||||
|
||||
//Local With Anchor Tag
|
||||
createActionButton('Anchor1', function () {
|
||||
doOpen(localhtml + '#bogusanchor', '_blank');
|
||||
}, 'openAnchor1');
|
||||
createActionButton('Anchor2', function () {
|
||||
doOpen(localhtml + '#anchor2', '_blank');
|
||||
}, 'openAnchor2');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user