Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9653af691 | ||
|
|
2c4bef1f97 | ||
|
|
e785533ab4 | ||
|
|
3056997c78 | ||
|
|
3f80b0b59c | ||
|
|
71b43d39a4 | ||
|
|
d2eaa089f8 | ||
|
|
1bf42c9e3b | ||
|
|
70d74e5273 | ||
|
|
2818011249 | ||
|
|
7a816d8454 | ||
|
|
50a78baf22 | ||
|
|
216ed8ae57 | ||
|
|
8012ae709b | ||
|
|
80010ae309 | ||
|
|
927e7a8e98 | ||
|
|
003f0fd3cd | ||
|
|
0d79919aa5 | ||
|
|
a0785deff8 | ||
|
|
e9eb234683 | ||
|
|
32c0e41c43 | ||
|
|
43592a4789 | ||
|
|
4b3a838704 | ||
|
|
ac0bdee8e6 | ||
|
|
22b3f0ccd4 | ||
|
|
6e0ea336fc | ||
|
|
f47f5449c2 | ||
|
|
d828197de4 | ||
|
|
6e38667320 | ||
|
|
ea6a4fc80a | ||
|
|
ac9c64964e | ||
|
|
225bde271b | ||
|
|
e5d07f14e8 | ||
|
|
863386398e | ||
|
|
ef9ca5ad3e |
@@ -130,6 +130,31 @@
|
||||
* 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
|
||||
* 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
|
||||
|
||||
@@ -77,6 +77,10 @@ Dieses Plugin bietet eine Web-Browser-Ansicht, die beim Aufruf angezeigt`window.
|
||||
* **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.
|
||||
|
||||
[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
|
||||
@@ -88,6 +92,7 @@ Dieses Plugin bietet eine Web-Browser-Ansicht, die beim Aufruf angezeigt`window.
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 und 8.1
|
||||
* Windows Phone 7 und 8
|
||||
|
||||
### Beispiel
|
||||
@@ -172,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); });
|
||||
@@ -203,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); }
|
||||
@@ -228,9 +235,10 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`.
|
||||
* 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();
|
||||
@@ -250,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...
|
||||
@@ -281,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() {
|
||||
@@ -312,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() {
|
||||
|
||||
124
doc/es/index.md
124
doc/es/index.md
@@ -33,28 +33,28 @@ Este plugin proporciona una vista de navegador web que se muestra cuando se llam
|
||||
|
||||
## 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, 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.
|
||||
@@ -69,25 +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][1] (por defecto`fullscreen`).
|
||||
* **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][2] (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.
|
||||
|
||||
[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
|
||||
@@ -128,7 +133,7 @@ Como plugin no cumplir cualquier diseño es necesario añadir algunas reglas CSS
|
||||
|
||||
## InAppBrowser
|
||||
|
||||
El objeto devuelto desde una llamada a`window.open`.
|
||||
El objeto devuelto desde una llamada a `window.open`.
|
||||
|
||||
### Métodos
|
||||
|
||||
@@ -141,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
|
||||
@@ -182,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
|
||||
@@ -215,19 +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
|
||||
@@ -240,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
|
||||
|
||||
@@ -260,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
|
||||
|
||||
@@ -292,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
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
* **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][1] (par défaut,`fullscreen`).
|
||||
* **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.
|
||||
|
||||
[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
|
||||
@@ -88,6 +92,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Exemple
|
||||
@@ -172,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
|
||||
@@ -203,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
|
||||
@@ -228,6 +235,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
* Windows Phone 7 et 8
|
||||
|
||||
### Petit exemple
|
||||
@@ -250,6 +258,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
|
||||
### Petit exemple
|
||||
|
||||
@@ -281,6 +290,7 @@ L'objet retourné par un appel à`window.open`.
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 et 8.1
|
||||
|
||||
### Petit exemple
|
||||
|
||||
|
||||
32
doc/index.md
32
doc/index.md
@@ -23,8 +23,23 @@ 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
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser
|
||||
* **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.
|
||||
|
||||
[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
|
||||
@@ -88,6 +92,7 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio
|
||||
@@ -172,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
|
||||
@@ -203,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
|
||||
@@ -228,6 +235,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Android
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
* Windows Phone 7 e 8
|
||||
|
||||
### Esempio rapido
|
||||
@@ -250,6 +258,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
|
||||
### Esempio rapido
|
||||
|
||||
@@ -281,6 +290,7 @@ L'oggetto restituito da una chiamata a`window.open`.
|
||||
* Amazon fuoco OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 e 8.1
|
||||
|
||||
### Esempio rapido
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
* **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
|
||||
@@ -88,6 +92,7 @@
|
||||
* ブラックベリー 10
|
||||
* Firefox の OS
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 例
|
||||
@@ -172,6 +177,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -203,6 +209,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -228,6 +235,7 @@
|
||||
* アンドロイド
|
||||
* Firefox の OS
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
* Windows Phone 7 と 8
|
||||
|
||||
### 簡単な例
|
||||
@@ -250,6 +258,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
|
||||
### 簡単な例
|
||||
|
||||
@@ -281,6 +290,7 @@
|
||||
* アマゾン火 OS
|
||||
* アンドロイド
|
||||
* iOS
|
||||
* Windows 8 および 8.1
|
||||
|
||||
### 簡単な例
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
* **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
|
||||
@@ -88,6 +92,7 @@
|
||||
* 블랙베리 10
|
||||
* Firefox 운영 체제
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 예를 들어
|
||||
@@ -172,6 +177,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -203,6 +209,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -228,6 +235,7 @@
|
||||
* 안 드 로이드
|
||||
* Firefox 운영 체제
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
* Windows Phone 7과 8
|
||||
|
||||
### 빠른 예제
|
||||
@@ -250,6 +258,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
|
||||
### 빠른 예제
|
||||
|
||||
@@ -281,6 +290,7 @@
|
||||
* 아마존 화재 운영 체제
|
||||
* 안 드 로이드
|
||||
* iOS
|
||||
* 윈도우 8과 8.1
|
||||
|
||||
### 빠른 예제
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywo
|
||||
|
||||
**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
|
||||
|
||||
@@ -77,17 +77,22 @@ Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglą
|
||||
* **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.
|
||||
|
||||
[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
|
||||
@@ -169,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
|
||||
@@ -200,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
|
||||
@@ -224,10 +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
|
||||
@@ -247,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
|
||||
|
||||
@@ -278,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
|
||||
|
||||
@@ -308,7 +318,7 @@ Obiekt zwrócony z wywołania`window.open`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
|
||||
@@ -77,17 +77,22 @@
|
||||
* **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 ОС
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Firefox OS
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
* Windows Phone 7 и 8
|
||||
|
||||
### Пример
|
||||
@@ -96,7 +101,7 @@
|
||||
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
|
||||
|
||||
|
||||
### Firefox OS причуды
|
||||
### Особенности Firefox OS
|
||||
|
||||
Как плагин не применять любой дизайн есть необходимость добавить некоторые правила CSS, если открыт с `target='_blank'` . Правила может выглядеть как эти
|
||||
|
||||
@@ -126,7 +131,7 @@
|
||||
}
|
||||
|
||||
|
||||
## InAppBrowser
|
||||
## Внутренний браузер
|
||||
|
||||
Объект, возвращаемый из вызова`window.open`.
|
||||
|
||||
@@ -169,12 +174,13 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* 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); });
|
||||
@@ -200,12 +206,13 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* 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); }
|
||||
@@ -224,13 +231,14 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* 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();
|
||||
@@ -247,11 +255,12 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
|
||||
### Быстрый пример
|
||||
### Краткий пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'hidden=yes');
|
||||
// some time later...
|
||||
@@ -278,11 +287,12 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
* Windows 8 и 8.1
|
||||
|
||||
### Быстрый пример
|
||||
### Краткий пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
@@ -308,11 +318,11 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* iOS
|
||||
|
||||
### Быстрый пример
|
||||
### Краткий пример
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
* **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
|
||||
@@ -88,6 +92,7 @@
|
||||
* 黑莓 10
|
||||
* 火狐瀏覽器的作業系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 示例
|
||||
@@ -172,6 +177,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -203,6 +209,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -228,6 +235,7 @@
|
||||
* Android 系統
|
||||
* 火狐瀏覽器的作業系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
* Windows Phone 7 和 8
|
||||
|
||||
### 快速的示例
|
||||
@@ -250,6 +258,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
|
||||
### 快速的示例
|
||||
|
||||
@@ -281,6 +290,7 @@
|
||||
* 亞馬遜火 OS
|
||||
* Android 系統
|
||||
* iOS
|
||||
* Windows 8 和 8.1
|
||||
|
||||
### 快速的示例
|
||||
|
||||
|
||||
22
plugin.xml
22
plugin.xml
@@ -20,7 +20,7 @@
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser"
|
||||
version="0.5.2">
|
||||
version="0.5.4">
|
||||
|
||||
<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">
|
||||
@@ -97,7 +97,7 @@
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_remove.png" target="res/drawable-xhdpi/ic_action_remove.png" />
|
||||
<resource-file src="src/android/res/drawable-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">
|
||||
@@ -179,7 +179,17 @@
|
||||
<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="/*">
|
||||
@@ -191,6 +201,6 @@
|
||||
<js-module src="src/firefoxos/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
</platform>
|
||||
</platform>
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -81,7 +81,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";
|
||||
|
||||
@@ -91,7 +90,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;
|
||||
|
||||
@@ -126,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);
|
||||
}
|
||||
}
|
||||
@@ -290,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;
|
||||
@@ -474,6 +471,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);
|
||||
@@ -509,9 +507,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);
|
||||
@@ -537,7 +532,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)
|
||||
@@ -577,14 +571,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)
|
||||
@@ -669,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();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -702,8 +695,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The webview client receives notifications about appView
|
||||
@@ -834,7 +825,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,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 +84,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;
|
||||
|
||||
@@ -287,12 +285,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;
|
||||
@@ -460,6 +454,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);
|
||||
@@ -495,9 +490,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);
|
||||
@@ -522,7 +514,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)
|
||||
@@ -562,14 +553,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)
|
||||
@@ -650,7 +640,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();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -683,8 +673,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The webview client receives notifications about appView
|
||||
@@ -815,7 +803,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,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;
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser.tests"
|
||||
version="0.5.2">
|
||||
version="0.5.4">
|
||||
<name>Cordova InAppBrowser Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
|
||||
@@ -19,16 +19,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
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 iab = window.open(url, target, params);
|
||||
if (!iab) {
|
||||
alert('window.open returned ' + iab);
|
||||
return;
|
||||
}
|
||||
|
||||
var counts;
|
||||
var lastLoadStartURL;
|
||||
var wasReset = false;
|
||||
@@ -43,6 +44,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
}
|
||||
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]++;
|
||||
@@ -80,10 +92,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
}
|
||||
}
|
||||
}
|
||||
iab.addEventListener('loaderror', logEvent);
|
||||
iab.addEventListener('loadstart', logEvent);
|
||||
iab.addEventListener('loadstop', logEvent);
|
||||
iab.addEventListener('exit', logEvent);
|
||||
|
||||
return iab;
|
||||
}
|
||||
@@ -167,7 +175,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
var info_div = '<h1>InAppBrowser</h1>' +
|
||||
'<div id="info">' +
|
||||
'Make sure http://www.google.com and https://www.google.com are white listed. </br>' +
|
||||
'Make sure http://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>' +
|
||||
@@ -193,17 +201,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
var white_listed_tests = '<h1>White Listed URL</h1>' +
|
||||
'<div id="openWhiteListed"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'Expected result: open successfully in CordovaWebView to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'Expected result: open successfully in CordovaWebView to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to www.google.com' +
|
||||
'Expected result: open successfully in system browser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'Expected result: open successfully in InAppBrowser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'Expected result: open successfully in InAppBrowser to cordova.apache.org' +
|
||||
'<p/> <div id="openWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com with no location bar.';
|
||||
'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>' +
|
||||
@@ -221,7 +229,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
var page_with_redirects_tests = '<h1>Page with redirect</h1>' +
|
||||
'<div id="openRedirect301"></div>' +
|
||||
'Expected result: should 301 and open successfully in InAppBrowser to www.google.com.' +
|
||||
'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.';
|
||||
|
||||
@@ -263,11 +271,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
'<div id="openHidden"></div>' +
|
||||
'Expected result: no additional browser window. Alert appears with the text "background window loaded".' +
|
||||
'<p/> <div id="showHidden"></div>' +
|
||||
'Expected result: after first clicking on previous test "create hidden", open successfully in InAppBrowser to google.com.' +
|
||||
'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 www.google.com';
|
||||
'Expected result: open successfully in InAppBrowser to https://www.google.co.uk';
|
||||
|
||||
var clearing_cache_tests = '<h1>Clearing Cache</h1>' +
|
||||
'<div id="openClearCache"></div>' +
|
||||
@@ -304,8 +312,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
var localhtml = basePath + 'local.html',
|
||||
localpdf = basePath + 'local.pdf',
|
||||
injecthtml = basePath + 'inject.html',
|
||||
injectjs = 'inject.js',
|
||||
injectcss = 'inject.css',
|
||||
injectjs = isWindows ? basePath + 'inject.js' : 'inject.js',
|
||||
injectcss = isWindows ? basePath + 'inject.css' : 'inject.css',
|
||||
videohtml = basePath + 'video.html';
|
||||
|
||||
//Local
|
||||
@@ -336,22 +344,22 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
//White Listed
|
||||
createActionButton('* target=Default', function () {
|
||||
doOpen('https://www.google.com');
|
||||
doOpen('http://cordova.apache.org');
|
||||
}, 'openWhiteListed');
|
||||
createActionButton('* target=_self', function () {
|
||||
doOpen('https://www.google.com', '_self');
|
||||
doOpen('http://cordova.apache.org', '_self');
|
||||
}, 'openWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('https://www.google.com', '_system');
|
||||
doOpen('http://cordova.apache.org', '_system');
|
||||
}, 'openWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('https://www.google.com', '_blank');
|
||||
doOpen('http://cordova.apache.org', '_blank');
|
||||
}, 'openWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('https://www.google.com', 'random_string');
|
||||
doOpen('http://cordova.apache.org', 'random_string');
|
||||
}, 'openWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('https://www.google.com', 'random_string', 'location=no');
|
||||
doOpen('http://cordova.apache.org', 'random_string', 'location=no');
|
||||
}, 'openWhiteListedRandomNoLocation');
|
||||
|
||||
//Non White Listed
|
||||
@@ -375,8 +383,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
}, 'openNonWhiteListedRandomNoLocation');
|
||||
|
||||
//Page with redirect
|
||||
createActionButton('http://google.com', function () {
|
||||
doOpen('http://google.com', 'random_string', '', 1);
|
||||
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);
|
||||
@@ -432,7 +440,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
//Open hidden
|
||||
createActionButton('Create Hidden', function () {
|
||||
openHidden('https://www.google.com', true);
|
||||
openHidden('https://www.google.co.uk', true);
|
||||
}, 'openHidden');
|
||||
createActionButton('Show Hidden', function () {
|
||||
showHidden();
|
||||
@@ -440,16 +448,16 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
createActionButton('Close Hidden', function () {
|
||||
closeHidden();
|
||||
}, 'closeHidden');
|
||||
createActionButton('google.com Not Hidden', function () {
|
||||
openHidden('https://www.google.com', false);
|
||||
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.com', '_blank', 'clearcache=yes');
|
||||
doOpen('https://www.google.co.uk', '_blank', 'clearcache=yes');
|
||||
}, 'openClearCache');
|
||||
createActionButton('Clear Session Cache', function () {
|
||||
doOpen('https://www.google.com', '_blank', 'clearsessioncache=yes');
|
||||
doOpen('https://www.google.co.uk', '_blank', 'clearsessioncache=yes');
|
||||
}, 'openClearSessionCache');
|
||||
|
||||
//Video tag
|
||||
|
||||
@@ -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