mirror of
https://github.com/shuto-cn/cordova-plugin-inappbrowser.git
synced 2026-05-04 00:00:06 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77d0c99998 | |||
| ba7cbe58d5 | |||
| 7d1b584306 | |||
| f614dc3193 | |||
| 05fa172116 | |||
| aacf70f888 | |||
| ea7e7674f8 | |||
| e2865db2ea | |||
| dfd0999581 | |||
| 461d9e9c4c | |||
| 16353c3466 | |||
| c85cab15b7 | |||
| 2c1ded2c43 | |||
| eb59809c34 | |||
| 805d43d61d | |||
| 9901d62248 |
+2
-2
@@ -6,8 +6,8 @@ node_js:
|
||||
install:
|
||||
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
- cd ..
|
||||
- npm install -g purplecabbage/cordova-paramedic
|
||||
- npm install -g cordova-paramedic
|
||||
- npm install -g cordova
|
||||
- npm install -g ios-sim
|
||||
script:
|
||||
- cordova-paramedic --platform ios --plugin ../cordova-plugin-inappbrowser
|
||||
- cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!---
|
||||
license: 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.
|
||||
<!--
|
||||
# license: 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.
|
||||
-->
|
||||
|
||||
# cordova-plugin-inappbrowser
|
||||
@@ -119,6 +119,7 @@ instance, or the system browser.
|
||||
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.
|
||||
- __fullscreen__: set to `yes` to create the browser control without a border around it. Please note that if __location=no__ is also specified, there will be no control presented to user to close IAB window.
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
@@ -167,6 +168,10 @@ opened with `target='_blank'`. The rules might look like these
|
||||
}
|
||||
```
|
||||
|
||||
### Windows Quirks
|
||||
|
||||
Similar to Firefox OS IAB window visual behaviour can be overridden via `inAppBrowserWrap`/`inAppBrowserWrapFullscreen` CSS classes
|
||||
|
||||
### Browser Quirks
|
||||
|
||||
- Plugin is implemented via iframe,
|
||||
@@ -349,6 +354,10 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
|
||||
- only __code__ key is supported.
|
||||
|
||||
### Windows Quirks
|
||||
|
||||
Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx) the invoked script can return only string values, otherwise the parameter, passed to __callback__ will be `[null]`.
|
||||
|
||||
## insertCSS
|
||||
|
||||
> Injects CSS into the `InAppBrowser` window.
|
||||
@@ -368,6 +377,7 @@ The function is passed an `InAppBrowserEvent` object.
|
||||
- Amazon Fire OS
|
||||
- Android
|
||||
- iOS
|
||||
- Windows
|
||||
|
||||
### Quick Example
|
||||
|
||||
|
||||
@@ -164,3 +164,29 @@
|
||||
* ubuntu: implement inject* functions
|
||||
* ubuntu: port to oxide
|
||||
* CB-7897 ios, android: Update to work with whilelist plugins in Cordova 4.x
|
||||
|
||||
### 1.0.0 (Apr 15, 2015)
|
||||
* CB-8746 gave plugin major version bump
|
||||
* CB-7689 Adds insertCSS support for windows platform
|
||||
* CB-4930 - (prefix) InAppBrowser should take into account the status bar
|
||||
* CB-8635 Improves UX on windows platform
|
||||
* CB-8661 Return executed script result on Windows
|
||||
* CB-8683 updated wp and browser specific references of old id to new id
|
||||
* CB-8683 changed plugin-id to pacakge-name
|
||||
* CB-8653 properly updated translated docs to use new id
|
||||
* CB-8653 updated translated docs to use new id
|
||||
* Use TRAVIS_BUILD_DIR, install paramedic by npm
|
||||
* CB-8432 Correct styles for browser wrapper to display it correctly on some pages
|
||||
* CB-8659 - Update InAppBrowser to support both cordova-ios 4.0.x and 3.x (closes #93)
|
||||
* CB-7961 Add cordova-plugin-inappbrowser support for browser platform
|
||||
* CB-8653 Updated Readme
|
||||
* Update docs for Android zoom=no option
|
||||
* Added option to disable/enable zoom controls
|
||||
* updated docs, set hardwareback default to true
|
||||
* Add a hardwareback option to allow for the hardware back button to go back.
|
||||
* CB-8570 Integrate TravisCI
|
||||
* CB-8438 cordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser
|
||||
* CB-8538 Added package.json file
|
||||
* Keep external android pages in a single tab. (close #61)
|
||||
* CB-8444 Add a clobber for `cordova.InAppBrowser.open` (close #80)
|
||||
* CB-8444 Don't clobber `window.open` - Add new symbol/clobber to access open function (`cordova.InAppBrowser.open`) - Change existing tests to use new symbol (i.e. don't rely on plugin clobber of `window.open`) - Add tests to use `window.open` via manual replace with new symbol - Update docs to deprecate plugin clobber of `window.open`
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Dieses Plugin bietet eine Web-Browser-Ansicht, die beim Aufruf von `cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Für rückwärts Kompatibilität, dieses Plugin auch `window.open` Haken. Jedoch
|
||||
|
||||
## Installation
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
Wenn Sie alle Seite Lasten in Ihrer Anwendung durch die InAppBrowser gehen möchten, können Sie einfach `window.open` während der Initialisierung Haken. Zum Beispiel:
|
||||
@@ -354,4 +354,4 @@ Bei einem Aufruf von `cordova.InAppBrowser.open` zurückgegebene Objekt..
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Este plugin proporciona una vista de navegador web que se muestra cuando se llama a `cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Aunque `window.open` es en el ámbito global, InAppBrowser no está disponible h
|
||||
|
||||
## Instalación
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
Si quieres todas las cargas de página en su aplicación para ir a través de la InAppBrowser, simplemente puedes conectar `window.open` durante la inicialización. Por ejemplo:
|
||||
@@ -354,4 +354,4 @@ El objeto devuelto desde una llamada a `cordova.InAppBrowser.open`.
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Ce module fournit une vue de navigateur web qui s'affiche lorsque vous appelez `cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Bien que `window.open` est dans la portée globale, InAppBrowser n'est pas dispo
|
||||
|
||||
## Installation
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
Si vous souhaitez que toutes les charges de la page dans votre application de passer par le InAppBrowser, vous pouvez simplement accrocher `window.open` pendant l'initialisation. Par exemple :
|
||||
@@ -354,4 +354,4 @@ L'objet retourné par un appel à `cordova.InAppBrowser.open`.
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Questo plugin fornisce una vista di browser web che viene visualizzato quando si chiama `di cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Sebbene `window.open` sia in ambito globale, InAppBrowser non è disponibile fin
|
||||
|
||||
## Installazione
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
Se si desidera che tutti i carichi di pagina nell'app di passare attraverso il InAppBrowser, si può semplicemente collegare `window.open` durante l'inizializzazione. Per esempio:
|
||||
@@ -354,4 +354,4 @@ L'oggetto restituito da una chiamata a `di cordova.InAppBrowser.open`.
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
このプラグインは `コルドバを呼び出すときに表示される web ブラウザーのビューを提供します。InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ InAppBrowser を提供しますデフォルトで GUI コントロール (戻る
|
||||
|
||||
## インストール
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
InAppBrowser を通過するアプリですべてのページの読み込みをする場合は初期化中に `window.open` を単にフックできます。たとえば。
|
||||
@@ -354,4 +354,4 @@ InAppBrowser を通過するアプリですべてのページの読み込みを
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
이 플러그인 `코르도바를 호출할 때 표시 하는 웹 브라우저 보기를 제공 합니다.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ InAppBrowser 창 표준 웹 브라우저 처럼 동작 및 코르도바 Api에
|
||||
|
||||
## 설치
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
InAppBrowser를 통해가 서 당신의 애플 리 케이 션에서 모든 페이지를 로드 하려는 경우 초기화 하는 동안 `window.open` 간단 하 게 연결할 수 있습니다. 예를 들어:
|
||||
@@ -354,4 +354,4 @@ InAppBrowser를 통해가 서 당신의 애플 리 케이 션에서 모든 페
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Chociaż `window.open` w globalnym zasięgu, InAppBrowser nie jest dostępne dop
|
||||
|
||||
## Instalacja
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
Jeśli chcesz wszystko stronica ładunki w swojej aplikacji, aby przejść przez InAppBrowser, można po prostu podłączyć `window.open` podczas inicjowania. Na przykład:
|
||||
@@ -354,4 +354,4 @@ Obiekt zwrócony z wywołania `cordova.InAppBrowser.open`.
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
Этот плагин обеспечивает представление веб-браузера, что показывает при вызове`window.open()`.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
## Установка
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
## window.open
|
||||
@@ -327,4 +327,4 @@
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# org.apache.cordova.inappbrowser
|
||||
# cordova-plugin-inappbrowser
|
||||
|
||||
這個外掛程式提供了一個 web 瀏覽器視圖,顯示在調用 `cordova.InAppBrowser.open()`.
|
||||
|
||||
@@ -48,7 +48,7 @@ InAppBrowser 預設情況下它自己的 GUI 控制項為使用者提供 (後
|
||||
|
||||
## 安裝
|
||||
|
||||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
cordova plugin add cordova-plugin-inappbrowser
|
||||
|
||||
|
||||
如果您希望所有頁面載入中您的應用程式要通過 InAppBrowser,你可以簡單地在初始化過程中鉤 `window.open`。舉個例子:
|
||||
@@ -354,4 +354,4 @@ InAppBrowser 預設情況下它自己的 GUI 控制項為使用者提供 (後
|
||||
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstop', function() {
|
||||
ref.insertCSS({file: "mystyles.css"});
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "cordova-plugin-inappbrowser",
|
||||
"version": "0.6.1-dev",
|
||||
"version": "1.0.1-dev",
|
||||
"description": "Cordova InAppBrowser Plugin",
|
||||
"cordova": {
|
||||
"id": "org.apache.cordova.inappbrowser",
|
||||
"id": "cordova-plugin-inappbrowser",
|
||||
"platforms": [
|
||||
"android",
|
||||
"amazon-fireos",
|
||||
|
||||
+3
-2
@@ -19,8 +19,8 @@
|
||||
-->
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser"
|
||||
version="0.6.1-dev">
|
||||
id="cordova-plugin-inappbrowser"
|
||||
version="1.0.1-dev">
|
||||
|
||||
<name>InAppBrowser</name>
|
||||
<description>Cordova InAppBrowser Plugin</description>
|
||||
@@ -197,6 +197,7 @@
|
||||
<js-module src="src/windows/InAppBrowserProxy.js" name="InAppBrowserProxy">
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
<asset src="www/inappbrowser.css" target="css/inappbrowser.css" />
|
||||
</platform>
|
||||
|
||||
<!-- firefoxos -->
|
||||
|
||||
@@ -198,19 +198,19 @@ var IAB = {
|
||||
},
|
||||
|
||||
injectScriptFile: function (win, fail, args) {
|
||||
var msg = 'Browser org.apache.cordova.inappbrowser injectScriptFile is not yet implemented';
|
||||
var msg = 'Browser cordova-plugin-inappbrowser injectScriptFile is not yet implemented';
|
||||
console.warn(msg);
|
||||
fail && fail(msg);
|
||||
},
|
||||
|
||||
injectStyleCode: function (win, fail, args) {
|
||||
var msg = 'Browser org.apache.cordova.inappbrowser injectStyleCode is not yet implemented';
|
||||
var msg = 'Browser cordova-plugin-inappbrowser injectStyleCode is not yet implemented';
|
||||
console.warn(msg);
|
||||
fail && fail(msg);
|
||||
},
|
||||
|
||||
injectStyleFile: function (win, fail, args) {
|
||||
var msg = 'Browser org.apache.cordova.inappbrowser injectStyleFile is not yet implemented';
|
||||
var msg = 'Browser cordova-plugin-inappbrowser injectStyleFile is not yet implemented';
|
||||
console.warn(msg);
|
||||
fail && fail(msg);
|
||||
}
|
||||
@@ -218,4 +218,4 @@ var IAB = {
|
||||
|
||||
module.exports = IAB;
|
||||
|
||||
require("cordova/exec/proxy").add("InAppBrowser", module.exports);
|
||||
require("cordova/exec/proxy").add("InAppBrowser", module.exports);
|
||||
|
||||
@@ -975,6 +975,20 @@
|
||||
|
||||
@implementation CDVInAppBrowserNavigationController : UINavigationController
|
||||
|
||||
- (void) viewDidLoad {
|
||||
|
||||
CGRect frame = [UIApplication sharedApplication].statusBarFrame;
|
||||
|
||||
// simplified from: http://stackoverflow.com/a/25669695/219684
|
||||
|
||||
UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:frame];
|
||||
bgToolbar.barStyle = UIBarStyleDefault;
|
||||
[self.view addSubview:bgToolbar];
|
||||
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark CDVScreenOrientationDelegate
|
||||
|
||||
- (BOOL)shouldAutorotate
|
||||
|
||||
@@ -34,7 +34,8 @@ var browserWrap,
|
||||
navigationButtonsDivInner,
|
||||
backButton,
|
||||
forwardButton,
|
||||
closeButton;
|
||||
closeButton,
|
||||
bodyOverflowStyle;
|
||||
|
||||
// x-ms-webview is available starting from Windows 8.1 (platformId is 'windows')
|
||||
// http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx
|
||||
@@ -86,6 +87,8 @@ var IAB = {
|
||||
if (win) win({ type: "exit" });
|
||||
|
||||
browserWrap.parentNode.removeChild(browserWrap);
|
||||
// Reset body overflow style to initial value
|
||||
document.body.style.msOverflowStyle = bodyOverflowStyle;
|
||||
browserWrap = null;
|
||||
popup = null;
|
||||
}
|
||||
@@ -109,24 +112,25 @@ var IAB = {
|
||||
} else {
|
||||
// "_blank" or anything else
|
||||
if (!browserWrap) {
|
||||
var browserWrapStyle = document.createElement('link');
|
||||
browserWrapStyle.rel = "stylesheet";
|
||||
browserWrapStyle.type = "text/css";
|
||||
browserWrapStyle.href = urlutil.makeAbsolute("/www/css/inappbrowser.css");
|
||||
|
||||
document.head.appendChild(browserWrapStyle);
|
||||
|
||||
browserWrap = document.createElement("div");
|
||||
// First reset all styles for inappbrowser wrapper element
|
||||
browserWrap.style.cssText = "margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background: 0 0;";
|
||||
browserWrap.style.position = "fixed";
|
||||
browserWrap.style.top = "0px";
|
||||
browserWrap.style.left = "0px";
|
||||
browserWrap.style.width = "100%";
|
||||
browserWrap.style.height = "100%";
|
||||
browserWrap.style.zIndex = 9999;
|
||||
browserWrap.style.border = "40px solid rgba(0,0,0,0.25)";
|
||||
browserWrap.className = "inAppBrowserWrap";
|
||||
|
||||
if (features.indexOf("fullscreen=yes") > -1) {
|
||||
browserWrap.classList.add("inAppBrowserWrapFullscreen");
|
||||
}
|
||||
|
||||
// Save body overflow style to be able to reset it back later
|
||||
var bodyOverflow = document.body.style.msOverflowStyle;
|
||||
bodyOverflowStyle = document.body.style.msOverflowStyle;
|
||||
|
||||
browserWrap.onclick = function () {
|
||||
setTimeout(function () {
|
||||
// Reset body overflow style to initial value
|
||||
document.body.style.msOverflowStyle = bodyOverflow;
|
||||
IAB.close(win);
|
||||
}, 0);
|
||||
};
|
||||
@@ -209,7 +213,7 @@ var IAB = {
|
||||
IAB.close(win);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
|
||||
if (!isWebViewAvailable) {
|
||||
// iframe navigation is not yet supported
|
||||
backButton.disabled = true;
|
||||
@@ -242,7 +246,10 @@ var IAB = {
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
var op = popup.invokeScriptAsync("eval", code);
|
||||
op.oncomplete = function () { hasCallback && win([]); };
|
||||
op.oncomplete = function (e) {
|
||||
var result = [e.target.result];
|
||||
hasCallback && win(result);
|
||||
};
|
||||
op.onerror = function () { };
|
||||
op.start();
|
||||
}
|
||||
@@ -261,15 +268,59 @@ var IAB = {
|
||||
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.oncomplete = function(e) {
|
||||
var result = [e.target.result];
|
||||
hasCallback && win(result);
|
||||
};
|
||||
op.onerror = function () { };
|
||||
op.start();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
injectStyleCode: function (win, fail, args) {
|
||||
var code = args[0],
|
||||
hasCallback = args[1];
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
injectCSS(popup, code, hasCallback && win);
|
||||
}
|
||||
},
|
||||
|
||||
injectStyleFile: function (win, fail, args) {
|
||||
var filePath = args[0],
|
||||
hasCallback = args[1];
|
||||
|
||||
filePath = filePath && urlutil.makeAbsolute(filePath);
|
||||
|
||||
if (isWebViewAvailable && browserWrap && popup) {
|
||||
var uri = new Windows.Foundation.Uri(filePath);
|
||||
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(function (file) {
|
||||
return Windows.Storage.FileIO.readTextAsync(file);
|
||||
}).done(function (code) {
|
||||
injectCSS(popup, code, hasCallback && win);
|
||||
}, function () {
|
||||
// no-op, just catch an error
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function injectCSS (webView, cssCode, callback) {
|
||||
// This will automatically escape all thing that we need (quotes, slashes, etc.)
|
||||
var escapedCode = JSON.stringify(cssCode);
|
||||
var evalWrapper = "(function(d){var c=d.createElement('style');c.innerHTML=%s;d.head.appendChild(c);})(document)"
|
||||
.replace('%s', escapedCode);
|
||||
|
||||
var op = webView.invokeScriptAsync("eval", evalWrapper);
|
||||
op.oncomplete = function() {
|
||||
callback && callback([]);
|
||||
};
|
||||
op.onerror = function () { };
|
||||
op.start();
|
||||
}
|
||||
|
||||
module.exports = IAB;
|
||||
|
||||
require("cordova/exec/proxy").add("InAppBrowser", module.exports);
|
||||
|
||||
@@ -159,14 +159,14 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
|
||||
public void injectScriptFile(string options)
|
||||
{
|
||||
Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support executeScript");
|
||||
Debug.WriteLine("Error : Windows Phone cordova-plugin-inappbrowser does not currently support executeScript");
|
||||
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
|
||||
// throw new NotImplementedException("Windows Phone does not currently support 'executeScript'");
|
||||
}
|
||||
|
||||
public void injectStyleCode(string options)
|
||||
{
|
||||
Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS");
|
||||
Debug.WriteLine("Error : Windows Phone cordova-plugin-inappbrowser does not currently support insertCSS");
|
||||
return;
|
||||
|
||||
//string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
|
||||
@@ -199,7 +199,7 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
|
||||
public void injectStyleFile(string options)
|
||||
{
|
||||
Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS");
|
||||
Debug.WriteLine("Error : Windows Phone cordova-plugin-inappbrowser does not currently support insertCSS");
|
||||
return;
|
||||
|
||||
//string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@
|
||||
-->
|
||||
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="org.apache.cordova.inappbrowser.tests"
|
||||
version="0.6.1-dev">
|
||||
id="cordova-plugin-inappbrowser-tests"
|
||||
version="1.0.1-dev">
|
||||
<name>Cordova InAppBrowser Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.inAppBrowserWrap {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
background: 0 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: calc(100% - 80px);
|
||||
height: calc(100% - 80px);
|
||||
z-index: 9999999;
|
||||
border: 40px solid #bfbfbf;
|
||||
border: 40px solid rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.inAppBrowserWrapFullscreen {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user