Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90d41e87ce | ||
|
|
19a2179d1d | ||
|
|
bfff56aef4 | ||
|
|
e5d6d6f69a | ||
|
|
88b71b3a57 | ||
|
|
a40a10f1ea | ||
|
|
514469ab24 | ||
|
|
abbbcc2461 | ||
|
|
b9653af691 | ||
|
|
2c4bef1f97 | ||
|
|
e785533ab4 | ||
|
|
3056997c78 | ||
|
|
3f80b0b59c | ||
|
|
71b43d39a4 | ||
|
|
d2eaa089f8 | ||
|
|
1bf42c9e3b | ||
|
|
70d74e5273 | ||
|
|
2818011249 | ||
|
|
80e4831a7f | ||
|
|
7a816d8454 | ||
|
|
50a78baf22 | ||
|
|
216ed8ae57 | ||
|
|
8012ae709b | ||
|
|
80010ae309 | ||
|
|
927e7a8e98 | ||
|
|
003f0fd3cd | ||
|
|
0d79919aa5 | ||
|
|
a0785deff8 | ||
|
|
e9eb234683 | ||
|
|
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,55 @@
|
||||
* 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
|
||||
|
||||
### 0.5.4 (Dec 02, 2014)
|
||||
* CB-7784 Exit event is not fired after `InAppBrowser` closing
|
||||
* CB-7697 Add `locationBar` support to `InAppBrowser` **Windows** platform version
|
||||
* CB-7690 `InAppBrowser` `loadstart/loadstop` events issues
|
||||
* CB-7695 Fix `InAppBrowser` `injectScriptFile` for **Windows 8.1** / **Windows Phone 8.1**
|
||||
* CB-7692 `InAppBrowser` local url opening bug in 8.1
|
||||
* CB-7688 `Alert` is not supported in `InAppBrowser` on **Windows** platform
|
||||
* CB-7977 Mention `deviceready` in plugin docs
|
||||
* CB-7876 change test target to avoid undesired redirects
|
||||
* CB-7712 remove references to `closebuttoncaption`
|
||||
* CB-7850 clarify role of whitelist
|
||||
* CB-7720 check if event is null since OK string from success callback was removed
|
||||
* CB-7471 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
|
||||
### 0.6.0 (Feb 04, 2015)
|
||||
* CB-8270 ios: Remove usage of `[arr JSONString]`, since it's been renamed to `cdv_JSONString`
|
||||
* ubuntu: implement inject* functions
|
||||
* ubuntu: port to oxide
|
||||
* CB-7897 ios, android: Update to work with whilelist plugins in Cordova 4.x
|
||||
|
||||
@@ -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,19 +74,25 @@ 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.
|
||||
|
||||
Nur Windows:
|
||||
|
||||
* **versteckte**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben.
|
||||
|
||||
[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 8 und 8.1
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
### Beispiel
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -152,9 +177,10 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstart', function(event) { alert(event.url); });
|
||||
@@ -183,9 +209,10 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
var myCallback = function(event) { alert(event.url); }
|
||||
@@ -206,10 +233,12 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.close();
|
||||
@@ -229,8 +258,9 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'hidden=yes');
|
||||
// some time later...
|
||||
@@ -260,8 +290,9 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
@@ -291,7 +322,7 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
### Kleines Beispiel
|
||||
### Kurzes Beispiel
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
|
||||
175
doc/es/index.md
175
doc/es/index.md
@@ -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,41 +31,30 @@ 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.
|
||||
Se abre una dirección URL en una nueva instancia de `InAppBrowser`, 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)*
|
||||
|
||||
* **URL**: el URL para cargar *(String)*. Llame a `encodeURI()` en este si la URL contiene caracteres Unicode.
|
||||
* **url**: el URL para cargar *(String)*. Llame a `encodeURI()` en esto si la URL contiene caracteres Unicode.
|
||||
|
||||
* **objetivo**: el objetivo en el que se carga la URL, un parámetro opcional que por defecto es `_self` . *(String)*
|
||||
* **target**: el objetivo en el que se carga la URL, un parámetro opcional que se utiliza de forma predeterminada `_self`. *(String)*
|
||||
|
||||
* `_self`: Se abre en el Cordova WebView si la URL está en la lista blanca, de lo contrario se abre en el`InAppBrowser`.
|
||||
* `_blank`: Se abre en el`InAppBrowser`.
|
||||
* `_system`: Se abre en el navegador web del sistema.
|
||||
* `_self`: se abre en el Cordova WebView si la URL está en la lista blanca, de lo contrario se abre en el `InAppBrowser`.
|
||||
* `_blank`: abre en el `InAppBrowser`.
|
||||
* `_system`: se abre en el navegador del sistema.
|
||||
|
||||
* **Opciones**: opciones para el `InAppBrowser` . Opcional, contumaz a: `location=yes` . *(String)*
|
||||
* **options**: opciones para el `InAppBrowser`. Opcional, contumaz a: `location=yes`. *(String)*
|
||||
|
||||
La `options` cadena no debe contener ningún espacio en blanco, y pares nombre/valor de cada característica deben estar separados por una coma. Los nombres de función son minúsculas. Todas las plataformas admiten el valor siguiente:
|
||||
La cadena de `options` no debe contener ningún espacio en blanco, y los pares de nombre y valor de cada característica deben estar separados por una coma. Los nombres de función son minúsculas. Todas las plataformas admiten el valor siguiente:
|
||||
|
||||
* **Ubicación**: A `yes` o `no` para activar el `InAppBrowser` de barra de ubicación activado o desactivado.
|
||||
* **location**: se establece en `yes` o `no` para activar o desactivar la barra de ubicación de la `InAppBrowser`.
|
||||
|
||||
Android sólo:
|
||||
Sólo Android:
|
||||
|
||||
* **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** .
|
||||
* **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente.
|
||||
@@ -80,24 +69,30 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act
|
||||
* **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana
|
||||
* **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana
|
||||
* **barra de herramientas**: a `yes` o `no` para activar la barra de herramientas on u off para el InAppBrowser (por defecto`yes`)
|
||||
* **enableViewportScale**: A `yes` o `no` para evitar la vista escala a través de una etiqueta meta (por defecto`no`).
|
||||
* **mediaPlaybackRequiresUserAction**: A `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto`no`).
|
||||
* **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`).
|
||||
* **enableViewportScale**: Set a `yes` o `no` para evitar viewport escalar a través de una etiqueta meta (por defecto a `no`).
|
||||
* **mediaPlaybackRequiresUserAction**: Set a `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto a `no`).
|
||||
* **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. Elemento `video` de HTML también debe incluir el atributo de `webkit-playsinline` (por defecto a `no`)
|
||||
* **keyboardDisplayRequiresUserAction**: se establece en `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante llamada de JavaScript de `focus()` (por defecto a `yes`).
|
||||
* **suppressesIncrementalRendering**: se establece en `yes` o `no` para esperar hasta que todos los nuevos contenidos de vista se recibieron antes de ser prestados (por defecto a `no`).
|
||||
* **presentationstyle**: se establece en `pagesheet`, `formsheet` o `fullscreen` para definir el [estilo de la presentación][1] (por defecto a `fullscreen`).
|
||||
* **transitionstyle**: se establece en `fliphorizontal`, `crossdissolve` o `coververtical` para definir 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.
|
||||
|
||||
Sólo Windows:
|
||||
|
||||
* **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente.
|
||||
|
||||
[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
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
### Ejemplo
|
||||
@@ -106,9 +101,39 @@ 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`.
|
||||
El objeto devuelto desde una llamada a `window.open`.
|
||||
|
||||
### Métodos
|
||||
|
||||
@@ -121,37 +146,38 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
## addEventListener
|
||||
|
||||
> Añade un detector para un evento de la`InAppBrowser`.
|
||||
> Añade un detector para un evento de la `InAppBrowser`.
|
||||
|
||||
ref.addEventListener(eventname, callback);
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)*
|
||||
* **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)*
|
||||
|
||||
* **eventName**: el evento para escuchar *(String)*
|
||||
|
||||
* **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL.
|
||||
* **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL.
|
||||
* **loaderror**: evento desencadena cuando el `InAppBrowser` encuentra un error al cargar una dirección URL.
|
||||
* **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana.
|
||||
* **loadstart**: evento se desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL.
|
||||
* **loadstop**: evento desencadena cuando los acabados `InAppBrowser` cargar una dirección URL.
|
||||
* **loaderror**: evento se desencadena cuando el `InAppBrowser` encuentra un error al cargar una dirección URL.
|
||||
* **exit**: evento se desencadena cuando se cierra la ventana de `InAppBrowser`.
|
||||
|
||||
* **devolución de llamada**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto como parámetro.
|
||||
* **callback**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un objeto `InAppBrowserEvent` como un parámetro.
|
||||
|
||||
### InAppBrowserEvent propiedades
|
||||
|
||||
* **tipo**: eventname, ya sea `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)*
|
||||
* **type**: eventname, `loadstart`, `loadstop`, `loaderror` o `exit`. *(String)*
|
||||
|
||||
* **URL**: la URL que se cargó. *(String)*
|
||||
* **url**: la URL que se cargó. *(String)*
|
||||
|
||||
* **código**: el código de error, sólo en el caso de `loaderror` . *(Número)*
|
||||
* **code**: el código de error, sólo en el caso de `loaderror`. *(Número)*
|
||||
|
||||
* **mensaje**: el mensaje de error, sólo en el caso de `loaderror` . *(String)*
|
||||
* **message**: el mensaje de error, sólo en el caso de `loaderror`. *(String)*
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
### Ejemplo rápido
|
||||
@@ -162,27 +188,28 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
## removeEventListener
|
||||
|
||||
> Elimina un detector para un evento de la`InAppBrowser`.
|
||||
> Elimina un detector para un evento de la `InAppBrowser`.
|
||||
|
||||
ref.removeEventListener(eventname, callback);
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)*
|
||||
* **ref**: referencia a la ventana de `InAppBrowser`. *(InAppBrowser)*
|
||||
|
||||
* **eventName**: dejar de escuchar para el evento. *(String)*
|
||||
|
||||
* **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL.
|
||||
* **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL.
|
||||
* **loaderror**: evento desencadena cuando el `InAppBrowser` se encuentra con un error al cargar una dirección URL.
|
||||
* **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana.
|
||||
* **loadstart**: evento se desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL.
|
||||
* **loadstop**: evento desencadena cuando los acabados `InAppBrowser` cargar una dirección URL.
|
||||
* **loaderror**: evento se desencadena cuando el `InAppBrowser` se encuentra con un error al cargar una dirección URL.
|
||||
* **exit**: evento se desencadena cuando se cierra la ventana de `InAppBrowser`.
|
||||
|
||||
* **devolución de llamada**: la función a ejecutar cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto.
|
||||
* **callback**: la función a ejecutar cuando se desencadene el evento. La función se pasa un objeto `InAppBrowserEvent`.
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
### Ejemplo rápido
|
||||
@@ -195,18 +222,20 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
## close
|
||||
|
||||
> Se cierra el `InAppBrowser` ventana.
|
||||
> Cierra la ventana de `InAppBrowser`.
|
||||
|
||||
Ref.Close();
|
||||
ref.close();
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)*
|
||||
* **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)*
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
* Windows Phone 7 y 8
|
||||
|
||||
### Ejemplo rápido
|
||||
@@ -219,16 +248,17 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
> Muestra una ventana InAppBrowser que abrió sus puertas ocultada. Esto no tiene efecto si el InAppBrowser ya era visible.
|
||||
|
||||
Ref.Show();
|
||||
ref.show();
|
||||
|
||||
|
||||
* **ref**: referencia a la (ventana) InAppBrowser`InAppBrowser`)
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
|
||||
### Ejemplo rápido
|
||||
|
||||
@@ -239,27 +269,28 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
## executeScript
|
||||
|
||||
> Inyecta código JavaScript en la `InAppBrowser` ventana
|
||||
> Inyecta código JavaScript en la ventana de `InAppBrowser`
|
||||
|
||||
ref.executeScript(details, callback);
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)*
|
||||
* **ref**: referencia a la ventana de `InAppBrowser`. *(InAppBrowser)*
|
||||
|
||||
* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)*
|
||||
|
||||
* **archivo**: URL de la secuencia de comandos para inyectar.
|
||||
* **código**: texto de la escritura para inyectar.
|
||||
* **file**: URL del script para inyectar.
|
||||
* **code**: texto de la escritura para inyectar.
|
||||
|
||||
* **devolución de llamada**: la función que se ejecuta después de inyecta el código JavaScript.
|
||||
|
||||
* Si el script inyectado es de tipo `code` , la devolución de llamada se ejecuta con un solo parámetro, que es el valor devuelto por el guión, envuelto en un `Array` . Para los scripts de varias líneas, este es el valor devuelto de la última declaración, o la última expresión evaluada.
|
||||
* Si el script inyectado es del tipo de `code`, la devolución de llamada se ejecuta con un solo parámetro, que es el valor devuelto del guión, envuelto en una `Array`. Para scripts multilíneas, este es el valor devuelto de la última declaración, o la última expresión evaluada.
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 y 8.1
|
||||
|
||||
### Ejemplo rápido
|
||||
|
||||
@@ -271,23 +302,23 @@ El objeto devuelto desde una llamada a`window.open`.
|
||||
|
||||
## insertCSS
|
||||
|
||||
> Inyecta CSS en la `InAppBrowser` ventana.
|
||||
> Inyecta CSS en la ventana de `InAppBrowser`.
|
||||
|
||||
ref.insertCSS(details, callback);
|
||||
|
||||
|
||||
* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)*
|
||||
* **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)*
|
||||
|
||||
* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)*
|
||||
|
||||
* **archivo**: URL de la hoja de estilos para inyectar.
|
||||
* **código**: texto de la hoja de estilos para inyectar.
|
||||
* **file**: URL de la hoja de estilos para inyectar.
|
||||
* **code**: texto de la hoja de estilos para inyectar.
|
||||
|
||||
* **devolución de llamada**: la función que se ejecuta después de inyectar el CSS.
|
||||
* **callback**: la función que se ejecuta después de inyectar el CSS.
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
|
||||
@@ -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)*
|
||||
@@ -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 :
|
||||
|
||||
* **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.
|
||||
|
||||
[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
|
||||
|
||||
|
||||
34
doc/index.md
34
doc/index.md
@@ -19,12 +19,27 @@
|
||||
|
||||
# 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');
|
||||
|
||||
__NOTE__: The InAppBrowser window behaves like a standard web browser,
|
||||
and can't access Cordova APIs.
|
||||
The InAppBrowser window behaves like a standard web browser,
|
||||
and can't access Cordova APIs. For this reason, the InAppBrowser is recommended
|
||||
if you need to load third-party (untrusted) content, instead of loading that
|
||||
into the main Cordova webview. The InAppBrowser is not subject to the
|
||||
whitelist, nor is opening links in the system browser.
|
||||
|
||||
The InAppBrowser provides by default its own GUI controls for the user (back,
|
||||
forward, done).
|
||||
|
||||
This plugin hooks `window.open`.
|
||||
|
||||
Although `window.open` is in the global scope, InAppBrowser is not available until after the `deviceready` event.
|
||||
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
function onDeviceReady() {
|
||||
console.log("window.open works well");
|
||||
}
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -55,7 +70,6 @@ instance, or the system browser.
|
||||
|
||||
Android only:
|
||||
|
||||
- __closebuttoncaption__: set to a string to use as the __Done__ button's caption.
|
||||
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
|
||||
- __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened
|
||||
- __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
|
||||
@@ -77,6 +91,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 +102,7 @@ instance, or the system browser.
|
||||
- BlackBerry 10
|
||||
- Firefox OS
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Example
|
||||
@@ -93,7 +112,7 @@ instance, or the system browser.
|
||||
|
||||
### Firefox OS Quirks
|
||||
|
||||
As plugin doesn't enforce any design there is a need to add some CSS rules if
|
||||
As plugin doesn't enforce any design there is a need to add some CSS rules if
|
||||
opened with `target='_blank'`. The rules might look like these
|
||||
|
||||
``` css
|
||||
@@ -169,6 +188,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 +219,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 +243,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 +264,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
|
||||
### Quick Example
|
||||
|
||||
@@ -273,6 +296,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,19 +74,25 @@ 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.
|
||||
|
||||
Solo per Windows:
|
||||
|
||||
* **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente.
|
||||
|
||||
[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 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -152,6 +177,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio rapido
|
||||
@@ -183,6 +209,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio rapido
|
||||
@@ -206,7 +233,9 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio rapido
|
||||
@@ -229,6 +258,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
|
||||
### Esempio rapido
|
||||
|
||||
@@ -260,6 +290,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
|
||||
### Esempio rapido
|
||||
|
||||
|
||||
@@ -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,19 +74,25 @@
|
||||
* **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` )。上部またはウィンドウの下部にツールバーが発生します。
|
||||
|
||||
Windows のみ:
|
||||
|
||||
* **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
|
||||
|
||||
[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 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 例
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -152,6 +177,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -183,6 +209,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -206,7 +233,9 @@
|
||||
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* Firefox の OS
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -229,6 +258,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
|
||||
### 簡単な例
|
||||
|
||||
@@ -260,6 +290,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
|
||||
### 簡単な例
|
||||
|
||||
|
||||
@@ -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,19 +74,25 @@
|
||||
* **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` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다.
|
||||
|
||||
Windows에만 해당:
|
||||
|
||||
* **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
|
||||
|
||||
[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
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 예를 들어
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -152,6 +177,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -183,6 +209,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -206,7 +233,9 @@
|
||||
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* Firefox 운영 체제
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -229,6 +258,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
|
||||
### 빠른 예제
|
||||
|
||||
@@ -260,6 +290,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
|
||||
### 빠른 예제
|
||||
|
||||
|
||||
@@ -19,34 +19,23 @@
|
||||
|
||||
# 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');
|
||||
|
||||
|
||||
**Uwaga**: The InAppBrowser okno zachowuje się jak standardowe przeglądarki, a nie ma dostępu do API Cordova.
|
||||
|
||||
## Instalacji
|
||||
## Instalacja
|
||||
|
||||
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,19 +74,25 @@ 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.
|
||||
|
||||
Windows tylko:
|
||||
|
||||
* **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie.
|
||||
|
||||
[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
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Jeżyna 10
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
### Przykład
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -149,9 +174,10 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
### Szybki przykład
|
||||
@@ -180,9 +206,10 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
### Szybki przykład
|
||||
@@ -204,9 +231,11 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
* Windows Phone 7 i 8
|
||||
|
||||
### Szybki przykład
|
||||
@@ -226,9 +255,10 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
|
||||
### Szybki przykład
|
||||
|
||||
@@ -257,9 +287,10 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 i 8.1
|
||||
|
||||
### Szybki przykład
|
||||
|
||||
@@ -287,7 +318,7 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
|
||||
330
doc/ru/index.md
Normal file
330
doc/ru/index.md
Normal file
@@ -0,0 +1,330 @@
|
||||
<!---
|
||||
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` ). Вызывает панели инструментов, чтобы быть в верхней или нижней части окна.
|
||||
|
||||
Windows только:
|
||||
|
||||
* **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
|
||||
|
||||
[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 OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
## Внутренний браузер
|
||||
|
||||
Объект, возвращаемый из вызова`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 OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
* 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 OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
* 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 OS
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
* 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 OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
|
||||
### Краткий пример
|
||||
|
||||
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 OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
|
||||
### Краткий пример
|
||||
|
||||
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 OS
|
||||
* 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,19 +74,25 @@
|
||||
* **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` )。使工具列,則在頂部或底部的視窗。
|
||||
|
||||
僅限 Windows:
|
||||
|
||||
* **隱藏**: 將設置為 `yes` ,創建瀏覽器並載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或被設置為 `no` (預設值),有的瀏覽器打開,以正常方式載入。
|
||||
|
||||
[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 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 示例
|
||||
@@ -106,6 +101,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`.
|
||||
@@ -152,6 +177,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -183,6 +209,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -206,7 +233,9 @@
|
||||
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* 火狐瀏覽器的作業系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -229,6 +258,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
|
||||
### 快速的示例
|
||||
|
||||
@@ -260,6 +290,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
|
||||
### 快速的示例
|
||||
|
||||
|
||||
42
plugin.xml
42
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.6.0">
|
||||
|
||||
<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">
|
||||
@@ -89,6 +106,7 @@
|
||||
<header-file src="src/ubuntu/inappbrowser.h" />
|
||||
<source-file src="src/ubuntu/inappbrowser.cpp" />
|
||||
<resource-file src="src/ubuntu/InAppBrowser.qml" />
|
||||
<resource-file src="src/ubuntu/InAppBrowser_escapeScript.js" />
|
||||
<resource-file src="src/ubuntu/close.png" />
|
||||
</platform>
|
||||
|
||||
@@ -162,11 +180,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 +202,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;
|
||||
@@ -78,17 +81,15 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private static final String LOAD_START_EVENT = "loadstart";
|
||||
private static final String LOAD_STOP_EVENT = "loadstop";
|
||||
private static final String LOAD_ERROR_EVENT = "loaderror";
|
||||
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
|
||||
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;
|
||||
private boolean showLocationBar = true;
|
||||
private boolean openWindowHidden = false;
|
||||
private String buttonLabel = "Done";
|
||||
private boolean clearAllCache= false;
|
||||
private boolean clearSessionCache=false;
|
||||
|
||||
@@ -123,21 +124,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(AmazonWebView.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);
|
||||
}
|
||||
}
|
||||
@@ -256,11 +260,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);
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -282,12 +291,8 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
option = new StringTokenizer(features.nextToken(), "=");
|
||||
if (option.hasMoreElements()) {
|
||||
String key = option.nextToken();
|
||||
if (key.equalsIgnoreCase(CLOSE_BUTTON_CAPTION)) {
|
||||
this.buttonLabel = option.nextToken();
|
||||
} else {
|
||||
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
|
||||
map.put(key, value);
|
||||
}
|
||||
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@@ -305,7 +310,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 +330,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 +419,10 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return this.showLocationBar;
|
||||
}
|
||||
|
||||
private InAppBrowser getInAppBrowser(){
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a new browser with the specified URL.
|
||||
*
|
||||
@@ -433,17 +471,14 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return value;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
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 +507,18 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
back.setLayoutParams(backLayoutParams);
|
||||
back.setContentDescription("Back Button");
|
||||
back.setId(2);
|
||||
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 +532,16 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
forward.setLayoutParams(forwardLayoutParams);
|
||||
forward.setContentDescription("Forward Button");
|
||||
forward.setId(3);
|
||||
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();
|
||||
@@ -516,14 +571,23 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
});
|
||||
|
||||
// Close button
|
||||
// Close/Done button
|
||||
Button close = new Button(cordova.getActivity());
|
||||
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
close.setLayoutParams(closeLayoutParams);
|
||||
forward.setContentDescription("Close Button");
|
||||
close.setId(5);
|
||||
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();
|
||||
@@ -598,7 +662,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// the goal of openhidden is to load the url and not display it
|
||||
// Show() needs to be called to cause the URL to be loaded
|
||||
if(openWindowHidden) {
|
||||
dialog.hide();
|
||||
dialog.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -631,8 +695,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The webview client receives notifications about appView
|
||||
@@ -763,7 +825,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,10 +54,13 @@ import org.apache.cordova.CordovaArgs;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
import org.apache.cordova.LOG;
|
||||
import org.apache.cordova.PluginManager;
|
||||
import org.apache.cordova.PluginResult;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -75,7 +78,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private static final String LOAD_START_EVENT = "loadstart";
|
||||
private static final String LOAD_STOP_EVENT = "loadstop";
|
||||
private static final String LOAD_ERROR_EVENT = "loaderror";
|
||||
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
|
||||
private static final String CLEAR_ALL_CACHE = "clearcache";
|
||||
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
|
||||
|
||||
@@ -85,7 +87,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private CallbackContext callbackContext;
|
||||
private boolean showLocationBar = true;
|
||||
private boolean openWindowHidden = false;
|
||||
private String buttonLabel = "Done";
|
||||
private boolean clearAllCache= false;
|
||||
private boolean clearSessionCache=false;
|
||||
|
||||
@@ -117,24 +118,55 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// SELF
|
||||
if (SELF.equals(target)) {
|
||||
Log.d(LOG_TAG, "in self");
|
||||
/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
|
||||
* Previously the Config class had a static method, isUrlWhitelisted(). That
|
||||
* responsibility has been moved to the plugins, with an aggregating method in
|
||||
* PluginManager.
|
||||
*/
|
||||
Boolean shouldAllowNavigation = null;
|
||||
if (url.startsWith("javascript:")) {
|
||||
shouldAllowNavigation = true;
|
||||
}
|
||||
if (shouldAllowNavigation == null) {
|
||||
try {
|
||||
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
|
||||
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
}
|
||||
if (shouldAllowNavigation == null) {
|
||||
try {
|
||||
Method gpm = webView.getClass().getMethod("getPluginManager");
|
||||
PluginManager pm = (PluginManager)gpm.invoke(webView);
|
||||
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
|
||||
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
}
|
||||
// load in webview
|
||||
if (url.startsWith("file://") || url.startsWith("javascript:")
|
||||
|| Config.isUrlWhiteListed(url)) {
|
||||
if (Boolean.TRUE.equals(shouldAllowNavigation)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -284,12 +316,8 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
option = new StringTokenizer(features.nextToken(), "=");
|
||||
if (option.hasMoreElements()) {
|
||||
String key = option.nextToken();
|
||||
if (key.equalsIgnoreCase(CLOSE_BUTTON_CAPTION)) {
|
||||
this.buttonLabel = option.nextToken();
|
||||
} else {
|
||||
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
|
||||
map.put(key, value);
|
||||
}
|
||||
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@@ -457,6 +485,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return value;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void run() {
|
||||
// Let's create the main dialog
|
||||
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||
@@ -492,9 +521,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
back.setLayoutParams(backLayoutParams);
|
||||
back.setContentDescription("Back Button");
|
||||
back.setId(2);
|
||||
/*
|
||||
back.setText("<");
|
||||
*/
|
||||
Resources activityRes = cordova.getActivity().getResources();
|
||||
int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable backIcon = activityRes.getDrawable(backResId);
|
||||
@@ -519,7 +545,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
forward.setLayoutParams(forwardLayoutParams);
|
||||
forward.setContentDescription("Forward Button");
|
||||
forward.setId(3);
|
||||
//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)
|
||||
@@ -559,14 +584,13 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
});
|
||||
|
||||
// Close button
|
||||
// Close/Done button
|
||||
Button close = new Button(cordova.getActivity());
|
||||
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
close.setLayoutParams(closeLayoutParams);
|
||||
forward.setContentDescription("Close Button");
|
||||
close.setId(5);
|
||||
//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)
|
||||
@@ -647,7 +671,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// the goal of openhidden is to load the url and not display it
|
||||
// Show() needs to be called to cause the URL to be loaded
|
||||
if(openWindowHidden) {
|
||||
dialog.hide();
|
||||
dialog.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -680,8 +704,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The webview client receives notifications about appView
|
||||
@@ -812,7 +834,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#import "CDVInAppBrowser.h"
|
||||
#import <Cordova/CDVPluginResult.h>
|
||||
#import <Cordova/CDVUserAgentUtil.h>
|
||||
#import <Cordova/CDVJSON.h>
|
||||
|
||||
#define kInAppBrowserTargetSelf @"_self"
|
||||
#define kInAppBrowserTargetSystem @"_system"
|
||||
@@ -265,7 +264,8 @@
|
||||
}
|
||||
|
||||
if (jsWrapper != nil) {
|
||||
NSString* sourceArrayString = [@[source] JSONString];
|
||||
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
|
||||
NSString* sourceArrayString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
if (sourceArrayString) {
|
||||
NSString* sourceString = [sourceArrayString substringWithRange:NSMakeRange(1, [sourceArrayString length] - 2)];
|
||||
NSString* jsToInject = [NSString stringWithFormat:jsWrapper, sourceString];
|
||||
@@ -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
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*
|
||||
*/
|
||||
import QtQuick 2.0
|
||||
import QtWebKit 3.0
|
||||
import Ubuntu.Components.Popups 0.1
|
||||
import Ubuntu.Components 0.1
|
||||
import com.canonical.Oxide 1.0
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
@@ -55,15 +55,38 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
property string usContext: "oxide://main-world/2"
|
||||
|
||||
function executeJS(scId, code) {
|
||||
var req = _view.rootFrame.sendMessage(usContext, "EXECUTE", {code: code});
|
||||
|
||||
req.onreply = function(response) {
|
||||
var code = 'cordova.callback(' + scId + ', JSON.parse(\'' + JSON.stringify(response.result) + '\'))';
|
||||
console.warn(code);
|
||||
cordova.javaScriptExecNeeded(code);
|
||||
console.warn("RESP:" + JSON.stringify(response));
|
||||
};
|
||||
}
|
||||
|
||||
WebView {
|
||||
width: parent.width
|
||||
y: urlEntry.height
|
||||
height: parent.height - y
|
||||
url: url1
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.status) {
|
||||
root.exec("InAppBrowser", "loadFinished", [loadRequest.status])
|
||||
}
|
||||
id: _view
|
||||
onLoadingStateChanged: {
|
||||
root.exec("InAppBrowser", "loadFinished", [_view.loading])
|
||||
}
|
||||
context: WebContext {
|
||||
id: webcontext
|
||||
|
||||
userScripts: [
|
||||
UserScript {
|
||||
context: usContext
|
||||
emulateGreasemonkey: true
|
||||
url: "InAppBrowser_escapeScript.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
src/ubuntu/InAppBrowser_escapeScript.js
Normal file
29
src/ubuntu/InAppBrowser_escapeScript.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
oxide.addMessageHandler("EXECUTE", function(msg) {
|
||||
var code = msg.args.code;
|
||||
try {
|
||||
msg.reply({result: eval(code)});
|
||||
} catch(e) {
|
||||
msg.error("Code threw exception: \"" + e + "\"");
|
||||
}
|
||||
});
|
||||
@@ -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,67 +40,66 @@ 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()";
|
||||
|
||||
const char EXIT_EVENT[] = "'exit'";
|
||||
const char LOADSTART_EVENT[] = "'loadstart'";
|
||||
const char LOADSTOP_EVENT[] = "'loadstop'";
|
||||
const char LOADERROR_EVENT[] = "'loaderror'";
|
||||
const char EXIT_EVENT[] = "{type: 'exit'}";
|
||||
const char LOADSTART_EVENT[] = "{type: 'loadstart'}";
|
||||
const char LOADSTOP_EVENT[] = "{type: 'loadstop'}";
|
||||
const char LOADERROR_EVENT[] = "{type: '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) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
void Inappbrowser::injectStyleFile(int scId, int ecId, const QString& src, bool b) {
|
||||
QString code("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %1; d.head.appendChild(c);})(document)");
|
||||
code = code.arg(CordovaInternal::format(src));
|
||||
|
||||
injectScriptCode(scId, ecId, code, b);
|
||||
}
|
||||
|
||||
void Inappbrowser::injectStyleCode(int cb, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
void Inappbrowser::injectStyleCode(int scId, int ecId, const QString& src, bool b) {
|
||||
QString code("(function(d) { var c = d.createElement('style'); c.innerHTML = %1; d.body.appendChild(c); })(document)");
|
||||
code = code.arg(CordovaInternal::format(src));
|
||||
|
||||
injectScriptCode(scId, ecId, code, b);
|
||||
}
|
||||
|
||||
void Inappbrowser::injectScriptFile(int cb, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
void Inappbrowser::injectScriptFile(int scId, int ecId, const QString& src, bool b) {
|
||||
QString code("(function(d) { var c = d.createElement('script'); c.src = %1; d.body.appendChild(c);})(document)");
|
||||
code = code.arg(CordovaInternal::format(src));
|
||||
|
||||
injectScriptCode(scId, ecId, code, b);
|
||||
}
|
||||
|
||||
void Inappbrowser::injectScriptCode(int cb, int, const QString&, bool) {
|
||||
// TODO:
|
||||
qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
|
||||
void Inappbrowser::injectScriptCode(int scId, int, const QString& code, bool) {
|
||||
m_cordova->execQML(QString("CordovaWrapper.global.inappbrowser.executeJS(%2, %1)").arg(CordovaInternal::format(code)).arg(scId));
|
||||
}
|
||||
|
||||
void Inappbrowser::loadFinished(int status) {
|
||||
if (status == 2) {
|
||||
this->callbackWithoutRemove(_eventCb, LOADERROR_EVENT);
|
||||
}
|
||||
if (status == 0) {
|
||||
void Inappbrowser::loadFinished(bool status) {
|
||||
if (!status) {
|
||||
this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT);
|
||||
} else {
|
||||
this->callbackWithoutRemove(_eventCb, LOADSTART_EVENT);
|
||||
}
|
||||
if (status == 3) {
|
||||
this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public slots:
|
||||
void injectScriptFile(int cb, int, const QString&, bool);
|
||||
void injectScriptCode(int cb, int, const QString&, bool);
|
||||
|
||||
void loadFinished(int status);
|
||||
void loadFinished(bool status);
|
||||
|
||||
private:
|
||||
int _eventCb;
|
||||
|
||||
260
src/windows/InAppBrowserProxy.js
Normal file
260
src/windows/InAppBrowserProxy.js
Normal file
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
*
|
||||
* 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'),
|
||||
urlutil = require('cordova/urlutil');
|
||||
|
||||
var browserWrap,
|
||||
popup,
|
||||
navigationButtonsDiv,
|
||||
navigationButtonsDivInner,
|
||||
backButton,
|
||||
forwardButton,
|
||||
closeButton;
|
||||
|
||||
// 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});
|
||||
});
|
||||
|
||||
element.addEventListener("MSWebViewContentLoading", function (e) {
|
||||
if (navigationButtonsDiv) {
|
||||
backButton.disabled = !popup.canGoBack;
|
||||
forwardButton.disabled = !popup.canGoForward;
|
||||
}
|
||||
});
|
||||
} 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 === "_self" || !target) {
|
||||
window.location = strUrl;
|
||||
} else {
|
||||
// "_blank" or anything else
|
||||
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(win);
|
||||
}, 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%";
|
||||
|
||||
browserWrap.appendChild(popup);
|
||||
|
||||
if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) {
|
||||
popup.style.height = "calc(100% - 60px)";
|
||||
|
||||
navigationButtonsDiv = document.createElement("div");
|
||||
navigationButtonsDiv.style.height = "60px";
|
||||
navigationButtonsDiv.style.backgroundColor = "#404040";
|
||||
navigationButtonsDiv.style.zIndex = "999";
|
||||
navigationButtonsDiv.onclick = function (e) {
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
|
||||
navigationButtonsDivInner = document.createElement("div");
|
||||
navigationButtonsDivInner.style.paddingTop = "10px";
|
||||
navigationButtonsDivInner.style.height = "50px";
|
||||
navigationButtonsDivInner.style.width = "160px";
|
||||
navigationButtonsDivInner.style.margin = "0 auto";
|
||||
navigationButtonsDivInner.style.backgroundColor = "#404040";
|
||||
navigationButtonsDivInner.style.zIndex = "999";
|
||||
navigationButtonsDivInner.onclick = function (e) {
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
|
||||
|
||||
backButton = document.createElement("button");
|
||||
backButton.style.width = "40px";
|
||||
backButton.style.height = "40px";
|
||||
backButton.style.borderRadius = "40px";
|
||||
|
||||
backButton.innerText = "<-";
|
||||
backButton.addEventListener("click", function (e) {
|
||||
if (popup.canGoBack)
|
||||
popup.goBack();
|
||||
});
|
||||
|
||||
forwardButton = document.createElement("button");
|
||||
forwardButton.style.marginLeft = "20px";
|
||||
forwardButton.style.width = "40px";
|
||||
forwardButton.style.height = "40px";
|
||||
forwardButton.style.borderRadius = "40px";
|
||||
|
||||
forwardButton.innerText = "->";
|
||||
forwardButton.addEventListener("click", function (e) {
|
||||
if (popup.canGoForward)
|
||||
popup.goForward();
|
||||
});
|
||||
|
||||
closeButton = document.createElement("button");
|
||||
closeButton.style.marginLeft = "20px";
|
||||
closeButton.style.width = "40px";
|
||||
closeButton.style.height = "40px";
|
||||
closeButton.style.borderRadius = "40px";
|
||||
|
||||
closeButton.innerText = "x";
|
||||
closeButton.addEventListener("click", function (e) {
|
||||
setTimeout(function () {
|
||||
IAB.close(win);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
if (!isWebViewAvailable) {
|
||||
// iframe navigation is not yet supported
|
||||
backButton.disabled = true;
|
||||
forwardButton.disabled = true;
|
||||
}
|
||||
|
||||
navigationButtonsDivInner.appendChild(backButton);
|
||||
navigationButtonsDivInner.appendChild(forwardButton);
|
||||
navigationButtonsDivInner.appendChild(closeButton);
|
||||
navigationButtonsDiv.appendChild(navigationButtonsDivInner);
|
||||
|
||||
browserWrap.appendChild(navigationButtonsDiv);
|
||||
} else {
|
||||
popup.style.height = "100%";
|
||||
}
|
||||
|
||||
// start listening for navigation events
|
||||
attachNavigationEvents(popup, win);
|
||||
|
||||
if (isWebViewAvailable) {
|
||||
strUrl = strUrl.replace("ms-appx://", "ms-appx-web://");
|
||||
}
|
||||
popup.src = 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 filePath = args[0],
|
||||
hasCallback = args[1];
|
||||
|
||||
if (!!filePath) {
|
||||
filePath = urlutil.makeAbsolute(filePath);
|
||||
}
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
var uri = new Windows.Foundation.Uri(filePath);
|
||||
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) {
|
||||
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.6.0">
|
||||
<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>
|
||||
476
tests/tests.js
Normal file
476
tests/tests.js
Normal file
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
*
|
||||
* 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 cordova = require('cordova');
|
||||
var isWindows = cordova.platformId == 'windows';
|
||||
|
||||
window.alert = window.alert || navigator.notification.alert;
|
||||
|
||||
exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
function doOpen(url, target, params, numExpectedRedirects) {
|
||||
numExpectedRedirects = numExpectedRedirects || 0;
|
||||
console.log("Opening " + url);
|
||||
|
||||
var counts;
|
||||
var lastLoadStartURL;
|
||||
var wasReset = false;
|
||||
function reset() {
|
||||
counts = {
|
||||
'loaderror': 0,
|
||||
'loadstart': 0,
|
||||
'loadstop': 0,
|
||||
'exit': 0
|
||||
};
|
||||
lastLoadStartURL = '';
|
||||
}
|
||||
reset();
|
||||
|
||||
var iab = window.open(url, target, params, {
|
||||
loaderror: logEvent,
|
||||
loadstart: logEvent,
|
||||
loadstop: logEvent,
|
||||
exit: logEvent
|
||||
});
|
||||
if (!iab) {
|
||||
alert('window.open returned ' + iab);
|
||||
return;
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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://cordova.apache.org and http://google.co.uk and https://www.google.co.uk 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 cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to cordova.apache.org 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 https://www.google.co.uk.' +
|
||||
'<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 https://www.google.co.uk.' +
|
||||
'<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 https://www.google.co.uk';
|
||||
|
||||
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 = isWindows ? basePath + 'inject.js' : 'inject.js',
|
||||
injectcss = isWindows ? basePath + 'inject.css' : '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('http://cordova.apache.org');
|
||||
}, 'openWhiteListed');
|
||||
createActionButton('* target=_self', function () {
|
||||
doOpen('http://cordova.apache.org', '_self');
|
||||
}, 'openWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('http://cordova.apache.org', '_system');
|
||||
}, 'openWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('http://cordova.apache.org', '_blank');
|
||||
}, 'openWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('http://cordova.apache.org', 'random_string');
|
||||
}, 'openWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('http://cordova.apache.org', '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.co.uk', function () {
|
||||
doOpen('http://google.co.uk', '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.co.uk', true);
|
||||
}, 'openHidden');
|
||||
createActionButton('Show Hidden', function () {
|
||||
showHidden();
|
||||
}, 'showHidden');
|
||||
createActionButton('Close Hidden', function () {
|
||||
closeHidden();
|
||||
}, 'closeHidden');
|
||||
createActionButton('google.co.uk Not Hidden', function () {
|
||||
openHidden('https://www.google.co.uk', false);
|
||||
}, 'openHiddenShow');
|
||||
|
||||
//Clearing cache
|
||||
createActionButton('Clear Browser Cache', function () {
|
||||
doOpen('https://www.google.co.uk', '_blank', 'clearcache=yes');
|
||||
}, 'openClearCache');
|
||||
createActionButton('Clear Session Cache', function () {
|
||||
doOpen('https://www.google.co.uk', '_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');
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ function InAppBrowser() {
|
||||
|
||||
InAppBrowser.prototype = {
|
||||
_eventHandler: function (event) {
|
||||
if (event.type in this.channels) {
|
||||
if (event && (event.type in this.channels)) {
|
||||
this.channels[event.type].fire(event);
|
||||
}
|
||||
},
|
||||
@@ -77,7 +77,7 @@ InAppBrowser.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function(strUrl, strWindowName, strWindowFeatures) {
|
||||
module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
|
||||
// Don't catch calls that write to existing frames (e.g. named iframes).
|
||||
if (window.frames && window.frames[strWindowName]) {
|
||||
var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
|
||||
@@ -86,6 +86,12 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures) {
|
||||
|
||||
strUrl = urlutil.makeAbsolute(strUrl);
|
||||
var iab = new InAppBrowser();
|
||||
|
||||
callbacks = callbacks || {};
|
||||
for (var callbackName in callbacks) {
|
||||
iab.addEventListener(callbackName, callbacks[callbackName]);
|
||||
}
|
||||
|
||||
var cb = function(eventname) {
|
||||
iab._eventHandler(eventname);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user