mirror of
https://github.com/shuto-cn/cordova-plugin-inappbrowser.git
synced 2026-01-26 00:00:04 +08:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ae4130296 | ||
|
|
32c0e41c43 | ||
|
|
43592a4789 | ||
|
|
4b3a838704 | ||
|
|
ac0bdee8e6 | ||
|
|
22b3f0ccd4 | ||
|
|
6e0ea336fc | ||
|
|
f47f5449c2 | ||
|
|
8ce6b497fa | ||
|
|
df90a6acc4 | ||
|
|
f90e571430 | ||
|
|
ec8c4527b9 | ||
|
|
faf37db5da | ||
|
|
5fc1beed0d | ||
|
|
832ff5f2e9 | ||
|
|
4f957919c7 | ||
|
|
81161ebe66 | ||
|
|
683937872d | ||
|
|
2c018a3460 | ||
|
|
315a0e30db | ||
|
|
69ca780772 | ||
|
|
79f73fbe62 | ||
|
|
97e0eac603 | ||
|
|
c2c94f315b | ||
|
|
d828197de4 | ||
|
|
6e38667320 | ||
|
|
ea6a4fc80a | ||
|
|
ac9c64964e | ||
|
|
225bde271b | ||
|
|
e5d07f14e8 | ||
|
|
863386398e | ||
|
|
ef9ca5ad3e |
@@ -119,3 +119,28 @@
|
||||
* **FFOS** app needs to be privileged
|
||||
* CB-6127 Updated translations for docs
|
||||
* CB-6769 ios: Fix statusbar color reset wasn't working on iOS7+
|
||||
|
||||
### 0.5.2 (Sep 17, 2014)
|
||||
* CB-7471 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
* CB-7490 Fixes InAppBrowser manual tests crash on windows platform
|
||||
* CB-7249 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
* CB-7424 Wrong docs: anchor tags are not supported by the InAppBrowser
|
||||
* CB-7133 clarify that anchor1 doesn't exist
|
||||
* CB-7133 more fixup of tests on Android
|
||||
* CB-7133 fix up the tests for Android
|
||||
* Add just a bit more logging
|
||||
* CB-7133 port inappbrowser to plugin-test-framework
|
||||
* phonegap events supported for \_blank target
|
||||
* inappbrowser \_blank target position is fixed
|
||||
* amazon-fireos related changes.
|
||||
|
||||
### 0.5.3 (Oct 03, 2014)
|
||||
* Windows implementation fixes and improvements
|
||||
* zIndex fixed
|
||||
* renamed InAppBrowser back to inappbrowser for case sensitive operating systems
|
||||
* Update french translation
|
||||
* Update doc to add Windows 8
|
||||
* Update windows proxy to be both compatible with windows 8 and 8.1
|
||||
* Rename windows81 by windows8 in src directory
|
||||
* Append Windows 8.1 platform configuration in plugin.xml
|
||||
* Append Windows 8.1 proxy using x-ms-webview
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
# 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
|
||||
|
||||
@@ -33,16 +33,16 @@ Dieses Plugin bietet eine Web-Browser-Ansicht, die anzeigt, beim Aufrufen von `w
|
||||
|
||||
## 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, 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`.
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -57,7 +57,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
Android uniquement :
|
||||
|
||||
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton.
|
||||
* **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
||||
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
||||
|
||||
@@ -65,7 +65,7 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu
|
||||
|
||||
* **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même.
|
||||
* **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce.
|
||||
* **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||
* **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre
|
||||
* **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre
|
||||
* **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`)
|
||||
@@ -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 :
|
||||
|
||||
* **hidden**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement.
|
||||
|
||||
[1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
|
||||
[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
|
||||
|
||||
|
||||
12
doc/index.md
12
doc/index.md
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
This plugin provides a web browser view that displays when calling `window.open()`, or when opening a link formed as `<a target="_blank">`.
|
||||
This plugin provides a web browser view that displays when calling `window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
@@ -77,6 +77,10 @@ instance, or the system browser.
|
||||
- __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`).
|
||||
- __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window.
|
||||
|
||||
Windows only:
|
||||
|
||||
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
- Amazon Fire OS
|
||||
@@ -84,6 +88,7 @@ instance, or the system browser.
|
||||
- BlackBerry 10
|
||||
- Firefox OS
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Example
|
||||
@@ -169,6 +174,7 @@ The object returned from a call to `window.open`.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -199,6 +205,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -222,6 +229,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Android
|
||||
- Firefox OS
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
- Windows Phone 7 and 8
|
||||
|
||||
### Quick Example
|
||||
@@ -242,6 +250,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
|
||||
### Quick Example
|
||||
|
||||
@@ -273,6 +282,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows 8 and 8.1
|
||||
|
||||
### Quick Example
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama `window.open()` , o quando un link di apertura formata come`<a target="_blank">`.
|
||||
Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
|
||||
Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `window.open()` , lub kiedy otwarcie łącza utworzone jako`<a target="_blank">`.
|
||||
Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania`window.open()`.
|
||||
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
39
plugin.xml
39
plugin.xml
@@ -20,7 +20,7 @@
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser"
|
||||
version="0.5.1">
|
||||
version="0.5.3">
|
||||
|
||||
<name>InAppBrowser</name>
|
||||
<description>Cordova InAppBrowser Plugin</description>
|
||||
@@ -32,7 +32,7 @@
|
||||
<engines>
|
||||
<engine name="cordova" version=">=3.1.0" /><!-- Needs cordova/urlutil -->
|
||||
</engines>
|
||||
|
||||
|
||||
<!-- android -->
|
||||
<platform name="android">
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
@@ -65,7 +65,7 @@
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
||||
|
||||
</platform>
|
||||
|
||||
|
||||
<!-- amazon-fireos -->
|
||||
<platform name="amazon-fireos">
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
@@ -78,9 +78,26 @@
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/amazon/InAppBrowser.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
<source-file src="src/android/InAppBrowserDialog.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
<source-file src="src/amazon/InAppChromeClient.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||
|
||||
<!-- drawable src/android/resources -->
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_next_item.png" target="res/drawable-hdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_next_item.png" target="res/drawable-mdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_next_item.png" target="res/drawable-xhdpi/ic_action_next_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_next_item.png" target="res/drawable-xxhdpi/ic_action_next_item.png" />
|
||||
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_previous_item.png" target="res/drawable-hdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_previous_item.png" target="res/drawable-mdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_previous_item.png" target="res/drawable-xhdpi/ic_action_previous_item.png" />
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_previous_item.png" target="res/drawable-xxhdpi/ic_action_previous_item.png" />
|
||||
|
||||
<resource-file src="src/android/res/drawable-hdpi/ic_action_remove.png" target="res/drawable-hdpi/ic_action_remove.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/ic_action_remove.png" target="res/drawable-mdpi/ic_action_remove.png" />
|
||||
<resource-file src="src/android/res/drawable-xhdpi/ic_action_remove.png" target="res/drawable-xhdpi/ic_action_remove.png" />
|
||||
<resource-file src="src/android/res/drawable-xxhdpi/ic_action_remove.png" target="res/drawable-xxhdpi/ic_action_remove.png" />
|
||||
</platform>
|
||||
|
||||
|
||||
<!-- ubuntu -->
|
||||
<platform name="ubuntu">
|
||||
<js-module src="www/inappbrowser.js" name="inappbrowser">
|
||||
@@ -162,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="/*">
|
||||
@@ -174,6 +201,6 @@
|
||||
<js-module src="src/firefoxos/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
</platform>
|
||||
</platform>
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
package org.apache.cordova.inappbrowser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import org.apache.cordova.inappbrowser.InAppBrowserDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
@@ -82,7 +85,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private static final String CLEAR_ALL_CACHE = "clearcache";
|
||||
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
|
||||
|
||||
private Dialog dialog;
|
||||
private InAppBrowserDialog dialog;
|
||||
private AmazonWebView inAppWebView;
|
||||
private EditText edittext;
|
||||
private CallbackContext callbackContext;
|
||||
@@ -256,11 +259,16 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
scriptToInject = source;
|
||||
}
|
||||
final String finalScriptToInject = scriptToInject;
|
||||
// This action will have the side-effect of blurring the currently focused element
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void run() {
|
||||
inAppWebView.loadUrl("javascript:" + finalScriptToInject);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
// This action will have the side-effect of blurring the currently focused element
|
||||
inAppWebView.loadUrl("javascript:" + finalScriptToInject);
|
||||
} /*else {
|
||||
inAppWebView.evaluateJavascript(finalScriptToInject, null);
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -305,7 +313,14 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
try {
|
||||
Intent intent = null;
|
||||
intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
// Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
|
||||
// Adding the MIME type to http: URLs causes them to not be handled by the downloader.
|
||||
Uri uri = Uri.parse(url);
|
||||
if ("file".equals(uri.getScheme())) {
|
||||
intent.setDataAndType(uri, webView.getResourceApi().getMimeType(uri));
|
||||
} else {
|
||||
intent.setData(uri);
|
||||
}
|
||||
this.cordova.getActivity().startActivity(intent);
|
||||
return "";
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
@@ -318,16 +333,38 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
* Closes the dialog
|
||||
*/
|
||||
public void closeDialog() {
|
||||
final AmazonWebView childView = this.inAppWebView;
|
||||
// The JS protects against multiple calls, so this should happen only when
|
||||
// closeDialog() is called by other native code.
|
||||
if (childView == null) {
|
||||
return;
|
||||
}
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
childView.setWebViewClient(new AmazonWebViewClient() {
|
||||
// NB: wait for about:blank before dismissing
|
||||
public void onPageFinished(AmazonWebView view, String url) {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
// NB: From SDK 19: "If you call methods on WebView from any thread
|
||||
// other than your app's UI thread, it can cause unexpected results."
|
||||
// http://developer.android.com/guide/webapps/migrating.html#Threads
|
||||
childView.loadUrl("about:blank");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("type", EXIT_EVENT);
|
||||
sendUpdate(obj, false);
|
||||
} catch (JSONException ex) {
|
||||
Log.d(LOG_TAG, "Should never happen");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if it is possible to go back one page in history, then does so.
|
||||
*/
|
||||
@@ -385,6 +422,10 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return this.showLocationBar;
|
||||
}
|
||||
|
||||
private InAppBrowser getInAppBrowser(){
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a new browser with the specified URL.
|
||||
*
|
||||
@@ -435,15 +476,11 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
|
||||
public void run() {
|
||||
// Let's create the main dialog
|
||||
dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
dialog.setInAppBroswer(getInAppBrowser());
|
||||
|
||||
// Main container layout
|
||||
LinearLayout main = new LinearLayout(cordova.getActivity());
|
||||
@@ -472,7 +509,21 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
back.setLayoutParams(backLayoutParams);
|
||||
back.setContentDescription("Back Button");
|
||||
back.setId(2);
|
||||
back.setText("<");
|
||||
/*
|
||||
back.setText("<");
|
||||
*/
|
||||
Resources activityRes = cordova.getActivity().getResources();
|
||||
int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable backIcon = activityRes.getDrawable(backResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
back.setBackgroundDrawable(backIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
back.setBackground(backIcon);
|
||||
}
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goBack();
|
||||
@@ -486,7 +537,17 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
forward.setLayoutParams(forwardLayoutParams);
|
||||
forward.setContentDescription("Forward Button");
|
||||
forward.setId(3);
|
||||
forward.setText(">");
|
||||
//forward.setText(">");
|
||||
int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable fwdIcon = activityRes.getDrawable(fwdResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
forward.setBackgroundDrawable(fwdIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
forward.setBackground(fwdIcon);
|
||||
}
|
||||
forward.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goForward();
|
||||
@@ -523,7 +584,17 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
close.setLayoutParams(closeLayoutParams);
|
||||
forward.setContentDescription("Close Button");
|
||||
close.setId(5);
|
||||
close.setText(buttonLabel);
|
||||
//close.setText(buttonLabel);
|
||||
int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable closeIcon = activityRes.getDrawable(closeResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
close.setBackgroundDrawable(closeIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
close.setBackground(closeIcon);
|
||||
}
|
||||
close.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
closeDialog();
|
||||
|
||||
@@ -120,21 +120,24 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// load in webview
|
||||
if (url.startsWith("file://") || url.startsWith("javascript:")
|
||||
|| Config.isUrlWhiteListed(url)) {
|
||||
Log.d(LOG_TAG, "loading in webview");
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
//Load the dialer
|
||||
else if (url.startsWith(WebView.SCHEME_TEL))
|
||||
{
|
||||
try {
|
||||
Log.d(LOG_TAG, "loading in dialer");
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
intent.setData(Uri.parse(url));
|
||||
cordova.getActivity().startActivity(intent);
|
||||
cordova.getActivity().startActivity(intent);
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
// load in InAppBrowser
|
||||
else {
|
||||
Log.d(LOG_TAG, "loading in InAppBrowser");
|
||||
result = showWebPage(url, features);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ var IABExecs = {
|
||||
if (browserWrap) {
|
||||
browserWrap.parentNode.removeChild(browserWrap);
|
||||
browserWrap = null;
|
||||
if (typeof(win) == "function") win({type:'exit'});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -71,6 +72,7 @@ var IABExecs = {
|
||||
function updateIframeSizeNoLocation() {
|
||||
browserWrap.style.width = window.innerWidth + 'px';
|
||||
browserWrap.style.height = window.innerHeight + 'px';
|
||||
browserWrap.style.zIndex = '999999999';
|
||||
browserWrap.browser.style.height = (window.innerHeight - 60) + 'px';
|
||||
browserWrap.browser.style.width = browserWrap.style.width;
|
||||
}
|
||||
@@ -91,7 +93,8 @@ var IABExecs = {
|
||||
browserWrap.browser = browserElem;
|
||||
|
||||
browserWrap.classList.add('inAppBrowserWrap');
|
||||
browserWrap.style.position = 'absolute';
|
||||
// position fixed so that it works even when page is scrolled
|
||||
browserWrap.style.position = 'fixed';
|
||||
browserElem.style.position = 'absolute';
|
||||
browserElem.style.border = 0;
|
||||
browserElem.style.top = '60px';
|
||||
@@ -135,7 +138,7 @@ var IABExecs = {
|
||||
|
||||
close.addEventListener('click', function () {
|
||||
setTimeout(function () {
|
||||
IABExecs.close();
|
||||
IABExecs.close(win, lose);
|
||||
}, 0);
|
||||
}, false);
|
||||
|
||||
@@ -154,6 +157,23 @@ var IABExecs = {
|
||||
browserWrap.appendChild(menu);
|
||||
browserWrap.appendChild(browserElem);
|
||||
document.body.appendChild(browserWrap);
|
||||
|
||||
//we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url
|
||||
browserElem.addEventListener('mozbrowserlocationchange', function(e){
|
||||
win({
|
||||
type:'loadstart',
|
||||
url : e.detail
|
||||
})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowserloadend', function(e){
|
||||
win({type:'loadstop'})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowsererror', function(e){
|
||||
win({type:'loaderror'})
|
||||
}, false);
|
||||
browserElem.addEventListener('mozbrowserclose', function(e){
|
||||
win({type:'exit'})
|
||||
}, false);
|
||||
} else {
|
||||
window.location = strUrl;
|
||||
}
|
||||
|
||||
158
src/windows/InAppBrowserProxy.js
Normal file
158
src/windows/InAppBrowserProxy.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true */
|
||||
/*global Windows:true, require, document, setTimeout, window, module */
|
||||
|
||||
|
||||
|
||||
var cordova = require('cordova'),
|
||||
channel = require('cordova/channel');
|
||||
|
||||
var browserWrap,
|
||||
popup;
|
||||
|
||||
// x-ms-webview is available starting from Windows 8.1 (platformId is 'windows')
|
||||
// http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx
|
||||
var isWebViewAvailable = cordova.platformId == 'windows';
|
||||
|
||||
function attachNavigationEvents(element, callback) {
|
||||
if (isWebViewAvailable) {
|
||||
element.addEventListener("MSWebViewNavigationStarting", function (e) {
|
||||
callback({ type: "loadstart", url: e.uri}, {keepCallback: true} );
|
||||
});
|
||||
element.addEventListener("MSWebViewNavigationCompleted", function (e) {
|
||||
callback({ type: e.isSuccess ? "loadstop" : "loaderror", url: e.uri}, {keepCallback: true});
|
||||
});
|
||||
element.addEventListener("MSWebViewUnviewableContentIdentified", function (e) {
|
||||
// WebView found the content to be not HTML.
|
||||
// http://msdn.microsoft.com/en-us/library/windows/apps/dn609716.aspx
|
||||
callback({ type: "loaderror", url: e.uri}, {keepCallback: true});
|
||||
});
|
||||
} else {
|
||||
var onError = function () {
|
||||
callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true});
|
||||
};
|
||||
|
||||
element.addEventListener("unload", function () {
|
||||
callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true});
|
||||
});
|
||||
element.addEventListener("load", function () {
|
||||
callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true});
|
||||
});
|
||||
|
||||
element.addEventListener("error", onError);
|
||||
element.addEventListener("abort", onError);
|
||||
}
|
||||
}
|
||||
|
||||
var IAB = {
|
||||
close: function (win, lose) {
|
||||
if (browserWrap) {
|
||||
if (win) win({ type: "exit" });
|
||||
|
||||
browserWrap.parentNode.removeChild(browserWrap);
|
||||
browserWrap = null;
|
||||
popup = null;
|
||||
}
|
||||
},
|
||||
show: function (win, lose) {
|
||||
if (browserWrap) {
|
||||
browserWrap.style.display = "block";
|
||||
}
|
||||
},
|
||||
open: function (win, lose, args) {
|
||||
var strUrl = args[0],
|
||||
target = args[1],
|
||||
features = args[2],
|
||||
url;
|
||||
|
||||
if (target === "_system") {
|
||||
url = new Windows.Foundation.Uri(strUrl);
|
||||
Windows.System.Launcher.launchUriAsync(url);
|
||||
} else if (target === "_blank") {
|
||||
if (!browserWrap) {
|
||||
browserWrap = document.createElement("div");
|
||||
browserWrap.style.position = "absolute";
|
||||
browserWrap.style.borderWidth = "40px";
|
||||
browserWrap.style.width = "calc(100% - 80px)";
|
||||
browserWrap.style.height = "calc(100% - 80px)";
|
||||
browserWrap.style.borderStyle = "solid";
|
||||
browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
|
||||
|
||||
browserWrap.onclick = function () {
|
||||
setTimeout(function () {
|
||||
IAB.close();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
document.body.appendChild(browserWrap);
|
||||
}
|
||||
|
||||
if (features.indexOf("hidden=yes") !== -1) {
|
||||
browserWrap.style.display = "none";
|
||||
}
|
||||
|
||||
popup = document.createElement(isWebViewAvailable ? "x-ms-webview" : "iframe");
|
||||
popup.style.borderWidth = "0px";
|
||||
popup.style.width = "100%";
|
||||
popup.style.height = "100%";
|
||||
popup.src = strUrl;
|
||||
|
||||
// start listening for navigation events
|
||||
attachNavigationEvents(popup, win);
|
||||
|
||||
browserWrap.appendChild(popup);
|
||||
|
||||
} else {
|
||||
window.location = strUrl;
|
||||
}
|
||||
},
|
||||
|
||||
injectScriptCode: function (win, fail, args) {
|
||||
var code = args[0],
|
||||
hasCallback = args[1];
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
var op = popup.invokeScriptAsync("eval", code);
|
||||
op.oncomplete = function () { hasCallback && win([]); };
|
||||
op.onerror = function () { };
|
||||
op.start();
|
||||
}
|
||||
},
|
||||
injectScriptFile: function (win, fail, args) {
|
||||
var file = args[0],
|
||||
hasCallback = args[1];
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
|
||||
var op = popup.invokeScriptAsync("eval", code);
|
||||
op.oncomplete = function () { hasCallback && win([]); };
|
||||
op.onerror = function () { };
|
||||
op.start();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = IAB;
|
||||
|
||||
require("cordova/exec/proxy").add("InAppBrowser", module.exports);
|
||||
31
tests/plugin.xml
Normal file
31
tests/plugin.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser.tests"
|
||||
version="0.5.3">
|
||||
<name>Cordova InAppBrowser Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<js-module src="tests.js" name="tests">
|
||||
</js-module>
|
||||
|
||||
<asset src="resources" target="cdvtests/iab-resources" />
|
||||
</plugin>
|
||||
21
tests/resources/inject.css
Normal file
21
tests/resources/inject.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
#style-update-file {
|
||||
display: block !important;
|
||||
}
|
||||
44
tests/resources/inject.html
Normal file
44
tests/resources/inject.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>Cordova Mobile Spec</title>
|
||||
<link rel="stylesheet" href="../../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
</head>
|
||||
<body id="stage" class="theme">
|
||||
<h1 id="header">InAppBrowser - Script / Style Injection Test</h1>
|
||||
<h2 id="style-update-file" style="display:none">Style updated from file</h2>
|
||||
<h2 id="style-update-literal" style="display:none">Style updated from literal</h2>
|
||||
<div>User-Agent: <cite id="u-a"></cite></div>
|
||||
</body>
|
||||
<script>
|
||||
function updateUserAgent() {
|
||||
document.getElementById("u-a").textContent = navigator.userAgent;
|
||||
}
|
||||
updateUserAgent();
|
||||
window.setInterval(updateUserAgent, 1500);
|
||||
</script>
|
||||
</html>
|
||||
20
tests/resources/inject.js
Normal file
20
tests/resources/inject.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
var d = document.getElementById("header")
|
||||
d.innerHTML = "Script file successfully injected";
|
||||
67
tests/resources/local.html
Normal file
67
tests/resources/local.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>IAB test page</title>
|
||||
<script type="text/javascript" charset="utf-8" src="../../cordova-incl.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
function onDeviceReady() {
|
||||
document.getElementById("hint").textContent = "Running CordovaWebView, deviceVersion=" + device.version + ", no toolbar should be present, Back link should work, logcat should NOT have failed 'gap:' calls.";
|
||||
}
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
</script>
|
||||
<style>
|
||||
body {background-color: #ffffff;}
|
||||
</style>
|
||||
</head>
|
||||
<body id="stage" class="theme">
|
||||
<h1>Local URL</h1>
|
||||
<div id="info">
|
||||
You have successfully loaded a local URL:
|
||||
<script>document.write(location.href)</script>
|
||||
</div>
|
||||
<hr />
|
||||
<div>User-Agent = <span id="u-a"></span></div>
|
||||
<hr />
|
||||
<div id="hint">Likely running inAppBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.</div>
|
||||
<hr />
|
||||
<div><a href="http://www.google.com">Visit Google</a> (whitelisted)</div>
|
||||
<div><a href="http://www.yahoo.com">Visit Yahoo</a> (not whitelisted)</div>
|
||||
<div><a href="http://www.stluciadance.com/prospectus_file/sample.pdf">Check out my remote PDF</a></div>
|
||||
<div><a href="local.pdf">Check out my local PDF</a></div>
|
||||
<p /><a href="javascript:;" onclick="history.back();">Back</a>
|
||||
<p />
|
||||
<a name="anchor2"></a>
|
||||
<div style="height: 1000px;border:1px solid red;">tall div with border</div>
|
||||
</body>
|
||||
<script>
|
||||
function updateUserAgent() {
|
||||
document.getElementById("u-a").textContent = navigator.userAgent;
|
||||
}
|
||||
updateUserAgent();
|
||||
window.setInterval(updateUserAgent, 1500);
|
||||
</script>
|
||||
</html>
|
||||
BIN
tests/resources/local.pdf
Normal file
BIN
tests/resources/local.pdf
Normal file
Binary file not shown.
42
tests/resources/video.html
Normal file
42
tests/resources/video.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
|
||||
<title>Cordova Mobile Spec</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<video width=100% height=100% id="player">
|
||||
<source src="http://m.comptoir-info.com/app/beta/sample.mp4">
|
||||
<meta property="og:video:secure_url" content="http://m.comptoir-info.com/app/beta/sample.mp4">
|
||||
<meta property="og:video:type" content="video/mp4">
|
||||
</video>
|
||||
<div>
|
||||
<button onclick="document.getElementById('player').play()"> play </button>
|
||||
<button onclick="document.getElementById('player').pause()"> pause </button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
468
tests/tests.js
Normal file
468
tests/tests.js
Normal file
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
function doOpen(url, target, params, numExpectedRedirects) {
|
||||
numExpectedRedirects = numExpectedRedirects || 0;
|
||||
console.log("Opening " + url);
|
||||
var iab = window.open(url, target, params);
|
||||
if (!iab) {
|
||||
alert('window.open returned ' + iab);
|
||||
return;
|
||||
}
|
||||
var counts;
|
||||
var lastLoadStartURL;
|
||||
var wasReset = false;
|
||||
function reset() {
|
||||
counts = {
|
||||
'loaderror': 0,
|
||||
'loadstart': 0,
|
||||
'loadstop': 0,
|
||||
'exit': 0
|
||||
};
|
||||
lastLoadStartURL = '';
|
||||
}
|
||||
reset();
|
||||
|
||||
function logEvent(e) {
|
||||
console.log('IAB event=' + JSON.stringify(e));
|
||||
counts[e.type]++;
|
||||
// Verify that event.url gets updated on redirects.
|
||||
if (e.type == 'loadstart') {
|
||||
if (e.url == lastLoadStartURL) {
|
||||
alert('Unexpected: loadstart fired multiple times for the same URL.');
|
||||
}
|
||||
lastLoadStartURL = e.url;
|
||||
}
|
||||
// Verify the right number of loadstart events were fired.
|
||||
if (e.type == 'loadstop' || e.type == 'loaderror') {
|
||||
if (e.url != lastLoadStartURL) {
|
||||
alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url');
|
||||
}
|
||||
if (numExpectedRedirects === 0 && counts['loadstart'] !== 1) {
|
||||
// Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL).
|
||||
if (!(e.type == 'loaderror' && counts['loadstart'] === 0)) {
|
||||
alert('Unexpected: got multiple loadstart events. (' + counts['loadstart'] + ')');
|
||||
}
|
||||
} else if (numExpectedRedirects > 0 && counts['loadstart'] < (numExpectedRedirects + 1)) {
|
||||
alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts['loadstart']);
|
||||
}
|
||||
wasReset = true;
|
||||
numExpectedRedirects = 0;
|
||||
reset();
|
||||
}
|
||||
// Verify that loadend / loaderror was called.
|
||||
if (e.type == 'exit') {
|
||||
var numStopEvents = counts['loadstop'] + counts['loaderror'];
|
||||
if (numStopEvents === 0 && !wasReset) {
|
||||
alert('Unexpected: browser closed without a loadstop or loaderror.')
|
||||
} else if (numStopEvents > 1) {
|
||||
alert('Unexpected: got multiple loadstop/loaderror events.');
|
||||
}
|
||||
}
|
||||
}
|
||||
iab.addEventListener('loaderror', logEvent);
|
||||
iab.addEventListener('loadstart', logEvent);
|
||||
iab.addEventListener('loadstop', logEvent);
|
||||
iab.addEventListener('exit', logEvent);
|
||||
|
||||
return iab;
|
||||
}
|
||||
|
||||
function openWithStyle(url, cssUrl, useCallback) {
|
||||
var iab = doOpen(url, '_blank', 'location=yes');
|
||||
var callback = function (results) {
|
||||
if (results && results.length === 0) {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
};
|
||||
if (cssUrl) {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.insertCSS({ file: cssUrl }, useCallback && callback);
|
||||
});
|
||||
} else {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.insertCSS({ code: '#style-update-literal { \ndisplay: block !important; \n}' },
|
||||
useCallback && callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openWithScript(url, jsUrl, useCallback) {
|
||||
var iab = doOpen(url, '_blank', 'location=yes');
|
||||
if (jsUrl) {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
iab.executeScript({ file: jsUrl }, useCallback && function (results) {
|
||||
if (results && results.length === 0) {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
iab.addEventListener('loadstop', function (event) {
|
||||
var code = '(function(){\n' +
|
||||
' var header = document.getElementById("header");\n' +
|
||||
' header.innerHTML = "Script literal successfully injected";\n' +
|
||||
' return "abc";\n' +
|
||||
'})()';
|
||||
iab.executeScript({ code: code }, useCallback && function (results) {
|
||||
if (results && results.length === 1 && results[0] === 'abc') {
|
||||
alert('Results verified');
|
||||
} else {
|
||||
console.log(results);
|
||||
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
var hiddenwnd = null;
|
||||
var loadlistener = function (event) { alert('background window loaded '); };
|
||||
function openHidden(url, startHidden) {
|
||||
var shopt = (startHidden) ? 'hidden=yes' : '';
|
||||
hiddenwnd = window.open(url, 'random_string', shopt);
|
||||
if (!hiddenwnd) {
|
||||
alert('window.open returned ' + hiddenwnd);
|
||||
return;
|
||||
}
|
||||
if (startHidden) hiddenwnd.addEventListener('loadstop', loadlistener);
|
||||
}
|
||||
function showHidden() {
|
||||
if (!!hiddenwnd) {
|
||||
hiddenwnd.show();
|
||||
}
|
||||
}
|
||||
function closeHidden() {
|
||||
if (!!hiddenwnd) {
|
||||
hiddenwnd.removeEventListener('loadstop', loadlistener);
|
||||
hiddenwnd.close();
|
||||
hiddenwnd = null;
|
||||
}
|
||||
}
|
||||
|
||||
var info_div = '<h1>InAppBrowser</h1>' +
|
||||
'<div id="info">' +
|
||||
'Make sure http://www.google.com and https://www.google.com are white listed. </br>' +
|
||||
'Make sure http://www.apple.com is not in the white list.</br>' +
|
||||
'In iOS, starred <span style="vertical-align:super">*</span> tests will put the app in a state with no way to return. </br>' +
|
||||
'<h4>User-Agent: <span id="user-agent"> </span></hr>' +
|
||||
'</div>';
|
||||
|
||||
var local_tests = '<h1>Local URL</h1>' +
|
||||
'<div id="openLocal"></div>' +
|
||||
'Expected result: opens successfully in CordovaWebView.' +
|
||||
'<p/> <div id="openLocalSelf"></div>' +
|
||||
'Expected result: opens successfully in CordovaWebView.' +
|
||||
'<p/> <div id="openLocalSystem"></div>' +
|
||||
'Expected result: fails to open' +
|
||||
'<p/> <div id="openLocalBlank"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar at top.' +
|
||||
'<p/> <div id="openLocalRandomNoLocation"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser without locationBar.' +
|
||||
'<p/> <div id="openLocalRandomToolBarBottom"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the bottom.' +
|
||||
'<p/> <div id="openLocalRandomToolBarTop"></div>' +
|
||||
'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the top.' +
|
||||
'<p/><div id="openLocalRandomToolBarTopNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with no locationBar. On iOS the toolbar is at the top.';
|
||||
|
||||
var white_listed_tests = '<h1>White Listed URL</h1>' +
|
||||
'<div id="openWhiteListed"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in CordovaWebView to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com' +
|
||||
'<p/> <div id="openWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com with no location bar.';
|
||||
|
||||
var non_white_listed_tests = '<h1>Non White Listed URL</h1>' +
|
||||
'<div id="openNonWhiteListed"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' +
|
||||
'<p/> <div id="openNonWhiteListedSelf"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' +
|
||||
'<p/> <div id="openNonWhiteListedSystem"></div>' +
|
||||
'Expected result: open successfully in system browser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedBlank"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedRandom"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com.' +
|
||||
'<p/> <div id="openNonWhiteListedRandomNoLocation"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to apple.com without locationBar.';
|
||||
|
||||
var page_with_redirects_tests = '<h1>Page with redirect</h1>' +
|
||||
'<div id="openRedirect301"></div>' +
|
||||
'Expected result: should 301 and open successfully in InAppBrowser to www.google.com.' +
|
||||
'<p/> <div id="openRedirect302"></div>' +
|
||||
'Expected result: should 302 and open successfully in InAppBrowser to www.zhihu.com/answer/16714076.';
|
||||
|
||||
var pdf_url_tests = '<h1>PDF URL</h1>' +
|
||||
'<div id="openPDF"></div>' +
|
||||
'Expected result: InAppBrowser opens. PDF should render on iOS.' +
|
||||
'<p/> <div id="openPDFBlank"></div>' +
|
||||
'Expected result: InAppBrowser opens. PDF should render on iOS.';
|
||||
|
||||
var invalid_url_tests = '<h1>Invalid URL</h1>' +
|
||||
'<div id="openInvalidScheme"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser.' +
|
||||
'<p/> <div id="openInvalidHost"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser.' +
|
||||
'<p/> <div id="openInvalidMissing"></div>' +
|
||||
'Expected result: fail to load in InAppBrowser (404).';
|
||||
|
||||
var css_js_injection_tests = '<h1>CSS / JS Injection</h1>' +
|
||||
'<div id="openOriginalDocument"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser without text "Style updated from..."' +
|
||||
'<p/> <div id="openCSSInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from file".' +
|
||||
'<p/> <div id="openCSSInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from file", and alert dialog with text "Results verified".' +
|
||||
'<p/> <div id="openCSSLiteralInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from literal".' +
|
||||
'<p/> <div id="openCSSLiteralInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with "Style updated from literal", and alert dialog with text "Results verified".' +
|
||||
'<p/> <div id="openScriptInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with text "Script file successfully injected".' +
|
||||
'<p/> <div id="openScriptInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with text "Script file successfully injected" and alert dialog with the text "Results verified".' +
|
||||
'<p/> <div id="openScriptLiteralInjection"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" .' +
|
||||
'<p/> <div id="openScriptLiteralInjectionCallback"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" and alert dialog with the text "Results verified".';
|
||||
|
||||
var open_hidden_tests = '<h1>Open Hidden </h1>' +
|
||||
'<div id="openHidden"></div>' +
|
||||
'Expected result: no additional browser window. Alert appears with the text "background window loaded".' +
|
||||
'<p/> <div id="showHidden"></div>' +
|
||||
'Expected result: after first clicking on previous test "create hidden", open successfully in InAppBrowser to google.com.' +
|
||||
'<p/> <div id="closeHidden"></div>' +
|
||||
'Expected result: no output. But click on "show hidden" again and nothing should be shown.' +
|
||||
'<p/> <div id="openHiddenShow"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to www.google.com';
|
||||
|
||||
var clearing_cache_tests = '<h1>Clearing Cache</h1>' +
|
||||
'<div id="openClearCache"></div>' +
|
||||
'Expected result: ?' +
|
||||
'<p/> <div id="openClearSessionCache"></div>' +
|
||||
'Expected result: ?';
|
||||
|
||||
var video_tag_tests = '<h1>Video tag</h1>' +
|
||||
'<div id="openRemoteVideo"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser with an embedded video that works after clicking the "play" button.';
|
||||
|
||||
var local_with_anchor_tag_tests = '<h1>Local with anchor tag</h1>' +
|
||||
'<div id="openAnchor1"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to the local page, scrolled to the top as normal.' +
|
||||
'<p/> <div id="openAnchor2"></div>' +
|
||||
'Expected result: open successfully in InAppBrowser to the local page, scrolled to the beginning of the tall div with border.';
|
||||
|
||||
// CB-7490 We need to wrap this code due to Windows security restrictions
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences for details
|
||||
if (window.MSApp && window.MSApp.execUnsafeLocalFunction) {
|
||||
MSApp.execUnsafeLocalFunction(function() {
|
||||
contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests +
|
||||
css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests;
|
||||
});
|
||||
} else {
|
||||
contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests +
|
||||
css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests;
|
||||
}
|
||||
|
||||
document.getElementById("user-agent").textContent = navigator.userAgent;
|
||||
|
||||
// we are already in cdvtests directory
|
||||
var basePath = 'iab-resources/';
|
||||
var localhtml = basePath + 'local.html',
|
||||
localpdf = basePath + 'local.pdf',
|
||||
injecthtml = basePath + 'inject.html',
|
||||
injectjs = 'inject.js',
|
||||
injectcss = 'inject.css',
|
||||
videohtml = basePath + 'video.html';
|
||||
|
||||
//Local
|
||||
createActionButton('target=Default', function () {
|
||||
doOpen(localhtml);
|
||||
}, 'openLocal');
|
||||
createActionButton('target=_self', function () {
|
||||
doOpen(localhtml, '_self');
|
||||
}, 'openLocalSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen(localhtml, '_system');
|
||||
}, 'openLocalSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen(localhtml, '_blank');
|
||||
}, 'openLocalBlank');
|
||||
createActionButton('target=Random, location=no, disallowoverscroll=yes', function () {
|
||||
doOpen(localhtml, 'random_string', 'location=no, disallowoverscroll=yes');
|
||||
}, 'openLocalRandomNoLocation');
|
||||
createActionButton('target=Random, toolbarposition=bottom', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=bottom');
|
||||
}, 'openLocalRandomToolBarBottom');
|
||||
createActionButton('target=Random, toolbarposition=top', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=top');
|
||||
}, 'openLocalRandomToolBarTop');
|
||||
createActionButton('target=Random, toolbarposition=top, location=no', function () {
|
||||
doOpen(localhtml, 'random_string', 'toolbarposition=top,location=no');
|
||||
}, 'openLocalRandomToolBarTopNoLocation');
|
||||
|
||||
//White Listed
|
||||
createActionButton('* target=Default', function () {
|
||||
doOpen('https://www.google.com');
|
||||
}, 'openWhiteListed');
|
||||
createActionButton('* target=_self', function () {
|
||||
doOpen('https://www.google.com', '_self');
|
||||
}, 'openWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('https://www.google.com', '_system');
|
||||
}, 'openWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('https://www.google.com', '_blank');
|
||||
}, 'openWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('https://www.google.com', 'random_string');
|
||||
}, 'openWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('https://www.google.com', 'random_string', 'location=no');
|
||||
}, 'openWhiteListedRandomNoLocation');
|
||||
|
||||
//Non White Listed
|
||||
createActionButton('target=Default', function () {
|
||||
doOpen('http://www.apple.com');
|
||||
}, 'openNonWhiteListed');
|
||||
createActionButton('target=_self', function () {
|
||||
doOpen('http://www.apple.com', '_self');
|
||||
}, 'openNonWhiteListedSelf');
|
||||
createActionButton('target=_system', function () {
|
||||
doOpen('http://www.apple.com', '_system');
|
||||
}, 'openNonWhiteListedSystem');
|
||||
createActionButton('target=_blank', function () {
|
||||
doOpen('http://www.apple.com', '_blank');
|
||||
}, 'openNonWhiteListedBlank');
|
||||
createActionButton('target=Random', function () {
|
||||
doOpen('http://www.apple.com', 'random_string');
|
||||
}, 'openNonWhiteListedRandom');
|
||||
createActionButton('* target=Random, no location bar', function () {
|
||||
doOpen('http://www.apple.com', 'random_string', 'location=no');
|
||||
}, 'openNonWhiteListedRandomNoLocation');
|
||||
|
||||
//Page with redirect
|
||||
createActionButton('http://google.com', function () {
|
||||
doOpen('http://google.com', 'random_string', '', 1);
|
||||
}, 'openRedirect301');
|
||||
createActionButton('http://goo.gl/pUFqg', function () {
|
||||
doOpen('http://goo.gl/pUFqg', 'random_string', '', 2);
|
||||
}, 'openRedirect302');
|
||||
|
||||
//PDF URL
|
||||
createActionButton('Remote URL', function () {
|
||||
doOpen('http://www.stluciadance.com/prospectus_file/sample.pdf');
|
||||
}, 'openPDF');
|
||||
createActionButton('Local URL', function () {
|
||||
doOpen(localpdf, '_blank');
|
||||
}, 'openPDFBlank');
|
||||
|
||||
//Invalid URL
|
||||
createActionButton('Invalid Scheme', function () {
|
||||
doOpen('x-ttp://www.invalid.com/', '_blank');
|
||||
}, 'openInvalidScheme');
|
||||
createActionButton('Invalid Host', function () {
|
||||
doOpen('http://www.inv;alid.com/', '_blank');
|
||||
}, 'openInvalidHost');
|
||||
createActionButton('Missing Local File', function () {
|
||||
doOpen('nonexistent.html', '_blank');
|
||||
}, 'openInvalidMissing');
|
||||
|
||||
//CSS / JS injection
|
||||
createActionButton('Original Document', function () {
|
||||
doOpen(injecthtml, '_blank');
|
||||
}, 'openOriginalDocument');
|
||||
createActionButton('CSS File Injection', function () {
|
||||
openWithStyle(injecthtml, injectcss);
|
||||
}, 'openCSSInjection');
|
||||
createActionButton('CSS File Injection (callback)', function () {
|
||||
openWithStyle(injecthtml, injectcss, true);
|
||||
}, 'openCSSInjectionCallback');
|
||||
createActionButton('CSS Literal Injection', function () {
|
||||
openWithStyle(injecthtml);
|
||||
}, 'openCSSLiteralInjection');
|
||||
createActionButton('CSS Literal Injection (callback)', function () {
|
||||
openWithStyle(injecthtml, null, true);
|
||||
}, 'openCSSLiteralInjectionCallback');
|
||||
createActionButton('Script File Injection', function () {
|
||||
openWithScript(injecthtml, injectjs);
|
||||
}, 'openScriptInjection');
|
||||
createActionButton('Script File Injection (callback)', function () {
|
||||
openWithScript(injecthtml, injectjs, true);
|
||||
}, 'openScriptInjectionCallback');
|
||||
createActionButton('Script Literal Injection', function () {
|
||||
openWithScript(injecthtml);
|
||||
}, 'openScriptLiteralInjection');
|
||||
createActionButton('Script Literal Injection (callback)', function () {
|
||||
openWithScript(injecthtml, null, true);
|
||||
}, 'openScriptLiteralInjectionCallback');
|
||||
|
||||
//Open hidden
|
||||
createActionButton('Create Hidden', function () {
|
||||
openHidden('https://www.google.com', true);
|
||||
}, 'openHidden');
|
||||
createActionButton('Show Hidden', function () {
|
||||
showHidden();
|
||||
}, 'showHidden');
|
||||
createActionButton('Close Hidden', function () {
|
||||
closeHidden();
|
||||
}, 'closeHidden');
|
||||
createActionButton('google.com Not Hidden', function () {
|
||||
openHidden('https://www.google.com', false);
|
||||
}, 'openHiddenShow');
|
||||
|
||||
//Clearing cache
|
||||
createActionButton('Clear Browser Cache', function () {
|
||||
doOpen('https://www.google.com', '_blank', 'clearcache=yes');
|
||||
}, 'openClearCache');
|
||||
createActionButton('Clear Session Cache', function () {
|
||||
doOpen('https://www.google.com', '_blank', 'clearsessioncache=yes');
|
||||
}, 'openClearSessionCache');
|
||||
|
||||
//Video tag
|
||||
createActionButton('Remote Video', function () {
|
||||
doOpen(videohtml, '_blank');
|
||||
}, 'openRemoteVideo');
|
||||
|
||||
//Local With Anchor Tag
|
||||
createActionButton('Anchor1', function () {
|
||||
doOpen(localhtml + '#bogusanchor', '_blank');
|
||||
}, 'openAnchor1');
|
||||
createActionButton('Anchor2', function () {
|
||||
doOpen(localhtml + '#anchor2', '_blank');
|
||||
}, 'openAnchor2');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user