├── .travis.yml
├── src
├── ubuntu
│ ├── close.png
│ ├── InAppBrowser_escapeScript.js
│ ├── inappbrowser.h
│ ├── InAppBrowser.qml
│ └── inappbrowser.cpp
├── android
│ ├── res
│ │ ├── drawable-hdpi
│ │ │ ├── ic_action_remove.png
│ │ │ ├── ic_action_next_item.png
│ │ │ └── ic_action_previous_item.png
│ │ ├── drawable-mdpi
│ │ │ ├── ic_action_remove.png
│ │ │ ├── ic_action_next_item.png
│ │ │ └── ic_action_previous_item.png
│ │ ├── drawable-xhdpi
│ │ │ ├── ic_action_remove.png
│ │ │ ├── ic_action_next_item.png
│ │ │ └── ic_action_previous_item.png
│ │ └── drawable-xxhdpi
│ │ │ ├── ic_action_remove.png
│ │ │ ├── ic_action_next_item.png
│ │ │ └── ic_action_previous_item.png
│ ├── InAppBrowserDialog.java
│ └── InAppChromeClient.java
├── blackberry10
│ ├── doc
│ │ ├── zh
│ │ │ └── README.md
│ │ ├── ko
│ │ │ └── README.md
│ │ ├── ja
│ │ │ └── README.md
│ │ ├── es
│ │ │ └── README.md
│ │ ├── de
│ │ │ └── README.md
│ │ ├── pl
│ │ │ └── README.md
│ │ ├── it
│ │ │ └── README.md
│ │ └── fr
│ │ │ └── README.md
│ └── README.md
├── ios
│ └── CDVInAppBrowser.h
├── amazon
│ └── InAppChromeClient.java
├── firefoxos
│ └── InAppBrowserProxy.js
└── browser
│ └── InAppBrowserProxy.js
├── tests
├── resources
│ ├── local.pdf
│ ├── inject.css
│ ├── inject.js
│ ├── video.html
│ ├── inject.html
│ └── local.html
└── plugin.xml
├── NOTICE
├── .gitignore
├── .jshintrc
├── .github
└── PULL_REQUEST_TEMPLATE.md
├── package.json
├── CONTRIBUTING.md
├── www
├── inappbrowser.css
├── inappbrowser.js
└── windows8
│ └── InAppBrowserProxy.js
├── doc
├── zh
│ ├── index.md
│ └── README.md
├── ko
│ ├── index.md
│ └── README.md
├── ja
│ ├── index.md
│ └── README.md
├── ru
│ └── index.md
└── pl
│ └── index.md
├── LICENSE
└── plugin.xml
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: false
3 | node_js:
4 | - "4.2"
5 |
--------------------------------------------------------------------------------
/src/ubuntu/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/ubuntu/close.png
--------------------------------------------------------------------------------
/tests/resources/local.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/tests/resources/local.pdf
--------------------------------------------------------------------------------
/src/android/res/drawable-hdpi/ic_action_remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-hdpi/ic_action_remove.png
--------------------------------------------------------------------------------
/src/android/res/drawable-mdpi/ic_action_remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-mdpi/ic_action_remove.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xhdpi/ic_action_remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xhdpi/ic_action_remove.png
--------------------------------------------------------------------------------
/src/android/res/drawable-hdpi/ic_action_next_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-hdpi/ic_action_next_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-mdpi/ic_action_next_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-mdpi/ic_action_next_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xhdpi/ic_action_next_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xhdpi/ic_action_next_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xxhdpi/ic_action_remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xxhdpi/ic_action_remove.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xxhdpi/ic_action_next_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xxhdpi/ic_action_next_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-hdpi/ic_action_previous_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-hdpi/ic_action_previous_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-mdpi/ic_action_previous_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-mdpi/ic_action_previous_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xhdpi/ic_action_previous_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xhdpi/ic_action_previous_item.png
--------------------------------------------------------------------------------
/src/android/res/drawable-xxhdpi/ic_action_previous_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Xzya/cordova-plugin-inappbrowser/master/src/android/res/drawable-xxhdpi/ic_action_previous_item.png
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Cordova
2 | Copyright 2012 The Apache Software Foundation
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #If ignorance is bliss, then somebody knock the smile off my face
2 |
3 | *.csproj.user
4 | *.suo
5 | *.cache
6 | Thumbs.db
7 | *.DS_Store
8 |
9 | *.bak
10 | *.cache
11 | *.log
12 | *.swp
13 | *.user
14 |
15 | node_modules
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "browser": true
3 | , "devel": true
4 | , "bitwise": true
5 | , "undef": true
6 | , "trailing": true
7 | , "quotmark": false
8 | , "indent": 4
9 | , "unused": "vars"
10 | , "latedef": "nofunc"
11 | , "globals": {
12 | "module": false,
13 | "exports": false,
14 | "require": false
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
9 |
10 | ### Platforms affected
11 |
12 |
13 | ### What does this PR do?
14 |
15 |
16 | ### What testing has been done on this change?
17 |
18 |
19 | ### Checklist
20 | - [ ] [ICLA](http://www.apache.org/licenses/icla.txt) has been signed and submitted to secretary@apache.org.
21 | - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
22 | - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
23 | - [ ] Added automated test coverage as appropriate for this change.
24 |
--------------------------------------------------------------------------------
/tests/resources/inject.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | #style-update-file {
20 | display: block !important;
21 | }
22 |
--------------------------------------------------------------------------------
/tests/resources/inject.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | var d = document.getElementById("header");
20 | d.innerHTML = "Script file successfully injected";
21 |
--------------------------------------------------------------------------------
/src/ubuntu/InAppBrowser_escapeScript.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | /* jshint -W061 */
23 | /* global oxide */
24 |
25 | oxide.addMessageHandler("EXECUTE", function(msg) {
26 | var code = msg.args.code;
27 | try {
28 | msg.reply({result: eval(code)});
29 | } catch(e) {
30 | msg.error("Code threw exception: \"" + e + "\"");
31 | }
32 | });
33 |
--------------------------------------------------------------------------------
/tests/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
24 | Cordova InAppBrowser Plugin Tests
25 | Apache 2.0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-plugin-inappbrowser",
3 | "version": "1.4.1-dev",
4 | "description": "Cordova InAppBrowser Plugin",
5 | "cordova": {
6 | "id": "cordova-plugin-inappbrowser",
7 | "platforms": [
8 | "android",
9 | "amazon-fireos",
10 | "ubuntu",
11 | "ios",
12 | "wp7",
13 | "wp8",
14 | "windows8",
15 | "windows",
16 | "firefoxos"
17 | ]
18 | },
19 | "repository": {
20 | "type": "git",
21 | "url": "https://github.com/apache/cordova-plugin-inappbrowser"
22 | },
23 | "keywords": [
24 | "cordova",
25 | "in",
26 | "app",
27 | "browser",
28 | "inappbrowser",
29 | "ecosystem:cordova",
30 | "cordova-android",
31 | "cordova-amazon-fireos",
32 | "cordova-ubuntu",
33 | "cordova-ios",
34 | "cordova-wp7",
35 | "cordova-wp8",
36 | "cordova-windows8",
37 | "cordova-windows",
38 | "cordova-firefoxos"
39 | ],
40 | "scripts": {
41 | "test": "npm run jshint",
42 | "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
43 | },
44 | "engines": {
45 | "cordovaDependencies": {
46 | "0.2.3": {
47 | "cordova": ">=3.1.0"
48 | }
49 | }
50 | },
51 | "author": "Apache Software Foundation",
52 | "license": "Apache-2.0",
53 | "devDependencies": {
54 | "jshint": "^2.6.0"
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/tests/resources/video.html:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | Cordova Mobile Spec
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | play
39 | pause
40 |
41 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/tests/resources/inject.html:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | Cordova Mobile Spec
29 |
30 |
31 |
32 |
33 | Style updated from file
34 | Style updated from literal
35 | User-Agent:
36 |
37 |
44 |
45 |
--------------------------------------------------------------------------------
/src/blackberry10/doc/zh/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # 黑莓 10 的應用程式瀏覽器外掛程式
21 |
22 | 在應用程式瀏覽器功能完全包含在常見的 js。 還有沒有本機的實施所需。 若要安裝此外掛程式,請按照[命令列介面指南](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | 如果你不使用的科爾多瓦命令列介面,請按照[使用 Plugman 管理外掛程式](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html)。 ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/ubuntu/inappbrowser.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2013 Canonical Ltd.
4 | *
5 | * Licensed to the Apache Software Foundation (ASF) under one
6 | * or more contributor license agreements. See the NOTICE file
7 | * distributed with this work for additional information
8 | * regarding copyright ownership. The ASF licenses this file
9 | * to you under the Apache License, Version 2.0 (the
10 | * "License"); you may not use this file except in compliance
11 | * with the License. You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing,
16 | * software distributed under the License is distributed on an
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 | * KIND, either express or implied. See the License for the
19 | * specific language governing permissions and limitations
20 | * under the License.
21 | *
22 | */
23 | #ifndef INAPPBROWSER_H
24 | #define INAPPBROWSER_H
25 |
26 | #include
27 | #include
28 |
29 | class Inappbrowser: public CPlugin {
30 | Q_OBJECT
31 | public:
32 | Inappbrowser(Cordova *cordova);
33 |
34 | virtual const QString fullName() override {
35 | return Inappbrowser::fullID();
36 | }
37 |
38 | virtual const QString shortName() override {
39 | return "InAppBrowser";
40 | }
41 |
42 | static const QString fullID() {
43 | return "InAppBrowser";
44 | }
45 |
46 | public slots:
47 | void open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures);
48 | void show(int, int);
49 | void close(int, int);
50 | void injectStyleFile(int cb, int, const QString&, bool);
51 | void injectStyleCode(int cb, int, const QString&, bool);
52 | void injectScriptFile(int cb, int, const QString&, bool);
53 | void injectScriptCode(int cb, int, const QString&, bool);
54 |
55 | void loadFinished(bool status);
56 |
57 | private:
58 | int _eventCb;
59 | };
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/src/blackberry10/doc/ko/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # 블랙베리 10 애플 리 케이 션-브라우저 플러그인
21 |
22 | 응용 프로그램 브라우저에서 기능은 완전히 포함 된 일반적인 js. 필요 없는 기본 구현이입니다. 이 플러그인을 설치 하려면 [명령줄 인터페이스 가이드](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface) 를 따라합니다.
23 |
24 | 코르도바 명령줄 인터페이스를 사용 하지 않는 경우 [관리 플러그인을 사용 하 여 Plugman](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html)를 따르십시오. ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/doc/ja/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10 In-App-Browser Plugin
21 |
22 | アプリケーション ブラウザーの機能は全く一般的な js に含まれています。 ネイティブ実装する必要はありません。 このプラグインをインストールするには[コマンド ライン インターフェイス ガイド](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | コルドバのコマンド ライン インターフェイスを使用していない場合は場合、[管理のプラグインを使用して Plugman](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html)に従ってください。 ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/android/InAppBrowserDialog.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.inappbrowser;
20 |
21 | import android.app.AlertDialog;
22 | import android.app.Dialog;
23 | import android.content.Context;
24 |
25 | import org.json.JSONException;
26 | import org.json.JSONObject;
27 |
28 | /**
29 | * Created by Oliver on 22/11/2013.
30 | */
31 | public class InAppBrowserDialog extends Dialog {
32 | Context context;
33 | InAppBrowser inAppBrowser = null;
34 |
35 | public InAppBrowserDialog(Context context, int theme) {
36 | super(context, theme);
37 | this.context = context;
38 | }
39 |
40 | public void setInAppBroswer(InAppBrowser browser) {
41 | this.inAppBrowser = browser;
42 | }
43 |
44 | public void onBackPressed () {
45 | if (this.inAppBrowser == null) {
46 | this.dismiss();
47 | } else {
48 | // better to go through the in inAppBrowser
49 | // because it does a clean up
50 | if (this.inAppBrowser.hardwareBack() && this.inAppBrowser.canGoBack()) {
51 | this.inAppBrowser.goBack();
52 | } else {
53 | this.inAppBrowser.closeDialog();
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/blackberry10/doc/es/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10 In-App-Browser Plugin
21 |
22 | El en el navegador de aplicación funcionalidad está enteramente dentro de js común. No hay ninguna aplicación nativa necesaria. Para instalar este plugin, siga la [Guía de la interfaz de línea de comandos](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | Si no utiliza la interfaz de línea de comandos de Cordova, siga [Usando Plugman para gestionar Plugins](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html). ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/doc/de/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10-In-App-Browser-Plugin
21 |
22 | Die Funktionalität ist im app-Browser vollständig in gemeinsamen Js enthalten. Es gibt keine native Implementierung benötigt. Um dieses Plugin zu installieren, folgen Sie dem [Command-Line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | Wenn Sie nicht die Cordova-Befehlszeilenschnittstelle verwenden, folgen Sie [Verwenden Plugman zu Plugins verwalten](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html). ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/doc/pl/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10 In-App-Browser Plugin
21 |
22 | W aplikacji Przeglądarka funkcjonalność jest całkowicie zawarty w wspólnej js. Tam jest nie native wdrażania wymagane. Aby zainstalować ten plugin, następować po ten [Przewodnik interfejsu wiersza polecenia](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | Jeśli nie używasz interfejsu wiersza polecenia Cordova, następować po [Przy użyciu Plugman do zarządzania wtyczki](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html). ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/doc/it/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10 In-App-Browser Plugin
21 |
22 | Il browser app funzionalità è interamente contenuta nel comune js. Non esiste alcuna implementazione nativa richiesto. Per installare questo plugin, seguire la [Guida per l'interfaccia della riga di comando](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | Se non si utilizza l'interfaccia della riga di comando di Cordova, seguire [Utilizzando Plugman per gestire i plugin](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html). ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/doc/fr/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # BlackBerry 10 In-App-Browser Plugin
21 |
22 | Le dans le navigateur de l'application, la fonctionnalité est entièrement contenue dans js commun. Il n'y a aucune implémentation native requise. Pour installer ce plugin, suivez le [Guide de l'Interface de ligne de commande](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | Si vous n'utilisez pas l'Interface de ligne de commande de Cordova, suivez [Les Plugman à l'aide à gérer les Plugins](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html). ./cordova-plugin-battery-status/README.md ./cordova-plugin-camera/README.md ./cordova-plugin-console/README.md ./cordova-plugin-contacts/README.md ./cordova-plugin-device/README.md ./cordova-plugin-device-motion/README.md ./cordova-plugin-device-orientation/README.md ./cordova-plugin-device-orientation/src/blackberry10/README.md ./cordova-plugin-file/README.md ./cordova-plugin-file-transfer/README.md ./cordova-plugin-geolocation/README.md ./cordova-plugin-globalization/README.md ./cordova-plugin-inappbrowser/README.md ./cordova-plugin-inappbrowser/src/blackberry10/README.md ./cordova-plugin-media/README.md ./cordova-plugin-media-capture/README.md ./cordova-plugin-network-information/README.md ./cordova-plugin-splashscreen/README.md ./cordova-plugin-vibration/README.md
--------------------------------------------------------------------------------
/src/blackberry10/README.md:
--------------------------------------------------------------------------------
1 |
19 | # BlackBerry 10 In-App-Browser Plugin
20 |
21 | The in app browser functionality is entirely contained within common js. There is no native implementation required.
22 | To install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
23 |
24 | If you are not using the Cordova Command-line Interface, follow [Using Plugman to Manage Plugins](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html).
25 | ./cordova-plugin-battery-status/README.md
26 | ./cordova-plugin-camera/README.md
27 | ./cordova-plugin-console/README.md
28 | ./cordova-plugin-contacts/README.md
29 | ./cordova-plugin-device/README.md
30 | ./cordova-plugin-device-motion/README.md
31 | ./cordova-plugin-device-orientation/README.md
32 | ./cordova-plugin-device-orientation/src/blackberry10/README.md
33 | ./cordova-plugin-file/README.md
34 | ./cordova-plugin-file-transfer/README.md
35 | ./cordova-plugin-geolocation/README.md
36 | ./cordova-plugin-globalization/README.md
37 | ./cordova-plugin-inappbrowser/README.md
38 | ./cordova-plugin-inappbrowser/src/blackberry10/README.md
39 | ./cordova-plugin-media/README.md
40 | ./cordova-plugin-media-capture/README.md
41 | ./cordova-plugin-network-information/README.md
42 | ./cordova-plugin-splashscreen/README.md
43 | ./cordova-plugin-vibration/README.md
44 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
21 |
22 | # Contributing to Apache Cordova
23 |
24 | Anyone can contribute to Cordova. And we need your contributions.
25 |
26 | There are multiple ways to contribute: report bugs, improve the docs, and
27 | contribute code.
28 |
29 | For instructions on this, start with the
30 | [contribution overview](http://cordova.apache.org/contribute/).
31 |
32 | The details are explained there, but the important items are:
33 | - Sign and submit an Apache ICLA (Contributor License Agreement).
34 | - Have a Jira issue open that corresponds to your contribution.
35 | - Run the tests so your patch doesn't break existing functionality.
36 |
37 | We look forward to your contributions!
38 |
39 | The notes on [Commit Workflow](https://github.com/apache/cordova-coho/blob/master/docs/committer-workflow.md#commit-workflow) can be helpful even if you are not a committer.
40 |
41 | ## Running plugin tests
42 |
43 | * clone and install [cordova-plugin-test-framework](https://github.com/apache/cordova-plugin-test-framework)
44 | ```
45 | git clone git@github.com:apache/cordova-plugin-test-framework.git
46 | ```
47 | * edit ```cordova-plugin-test-framework/www/assets/index.html``` and add the following line
48 | ```
49 |
50 | ```
51 | * create test project
52 | ```
53 | cordova create plugintest
54 | cd plugintest
55 | cordova platform add android
56 | cordova plugin add ../cordova-plugin-inappbrowser
57 | cordova plugin add ../cordova-plugin-inappbrowser/tests
58 | cordova plugin add ../cordova-plugin-test-framework
59 | ```
60 | * edit ```config.xml``` and replace ``` ``` with ``` ```
61 | * run application
62 | ```
63 | cordova run
64 | ```
65 |
--------------------------------------------------------------------------------
/www/inappbrowser.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | .inAppBrowserWrap {
21 | margin: 0;
22 | padding: 0;
23 | outline: 0;
24 | font-size: 100%;
25 | vertical-align: baseline;
26 | background: 0 0;
27 | position: fixed;
28 | top: 0;
29 | left: 0;
30 | width: 100%;
31 | height: 100%;
32 | z-index: 9999999;
33 | box-sizing: border-box;
34 | border: 40px solid #bfbfbf;
35 | border: 40px solid rgba(0, 0, 0, 0.25);
36 | }
37 |
38 | .inAppBrowserWrapFullscreen {
39 | border: 0;
40 | }
41 |
42 | .inappbrowser-app-bar {
43 | height: 70px;
44 | background-color: #404040;
45 | z-index: 9999999;
46 | }
47 |
48 | .inappbrowser-app-bar-inner {
49 | padding-top: 10px;
50 | height: 60px;
51 | width: 155px;
52 | margin: 0 auto;
53 | background-color: #404040;
54 | z-index: 9999999;
55 | }
56 |
57 | .app-bar-action {
58 | width: auto;
59 | height: 40px;
60 | margin-left: 20px;
61 | font-family: "Segoe UI Symbol";
62 | float: left;
63 | color: white;
64 | font-size: 12px;
65 | text-transform: lowercase;
66 | text-align: center;
67 | cursor: default;
68 | }
69 |
70 | .app-bar-action[disabled] {
71 | color: gray;
72 | /*disable click*/
73 | pointer-events: none;
74 | }
75 |
76 | .app-bar-action::before {
77 | font-size: 28px;
78 | display: block;
79 | height: 36px;
80 | }
81 |
82 | /* Back */
83 | .action-back {
84 | margin-left: 0px;
85 | }
86 |
87 | .action-back::before {
88 | content: "\E0BA";
89 | }
90 |
91 | .action-back:not([disabled]):hover::before {
92 | content: "\E0B3";
93 | }
94 |
95 | /* Forward */
96 | .action-forward::before {
97 | content: "\E0AC";
98 | }
99 |
100 | .action-forward:not([disabled]):hover::before {
101 | content: "\E0AF";
102 | }
103 |
104 | /* Close */
105 | .action-close::before {
106 | content: "\E0C7";
107 | /* close icon is larger so we re-size it to fit other icons */
108 | font-size: 20px;
109 | line-height: 40px;
110 | }
111 |
112 | .action-close:not([disabled]):hover::before {
113 | content: "\E0CA";
114 | }
115 |
--------------------------------------------------------------------------------
/tests/resources/local.html:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | IAB test page
29 |
30 |
36 |
39 |
40 |
41 | Local URL
42 |
43 | You have successfully loaded a local URL:
44 |
45 |
46 |
47 | User-Agent =
48 |
49 | Likely running inAppBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.
50 |
51 |
52 |
53 |
54 |
55 |
Back
56 |
57 |
58 | tall div with border
59 |
60 |
67 |
68 |
--------------------------------------------------------------------------------
/src/ubuntu/InAppBrowser.qml:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2013 Canonical Ltd.
4 | *
5 | * Licensed to the Apache Software Foundation (ASF) under one
6 | * or more contributor license agreements. See the NOTICE file
7 | * distributed with this work for additional information
8 | * regarding copyright ownership. The ASF licenses this file
9 | * to you under the Apache License, Version 2.0 (the
10 | * "License"); you may not use this file except in compliance
11 | * with the License. You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing,
16 | * software distributed under the License is distributed on an
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 | * KIND, either express or implied. See the License for the
19 | * specific language governing permissions and limitations
20 | * under the License.
21 | *
22 | */
23 | import QtQuick 2.0
24 | import Ubuntu.Components.Popups 0.1
25 | import Ubuntu.Components 0.1
26 | import com.canonical.Oxide 1.0
27 |
28 | Rectangle {
29 | anchors.fill: parent
30 | id: inappbrowser
31 | property string url1
32 | Rectangle {
33 | border.color: "black"
34 | width: parent.width
35 | height: urlEntry.height
36 | color: "gray"
37 | TextInput {
38 | id: urlEntry
39 | width: parent.width - closeButton.width
40 | text: url1
41 | activeFocusOnPress: false
42 | }
43 | Image {
44 | id: closeButton
45 | width: height
46 | x: parent.width - width
47 | height: parent.height
48 | source: "close.png"
49 | MouseArea {
50 | anchors.fill: parent
51 | onClicked: {
52 | root.exec("InAppBrowser", "close", [0, 0])
53 | }
54 | }
55 | }
56 | }
57 |
58 | property string usContext: "oxide://main-world/2"
59 |
60 | function executeJS(scId, code) {
61 | var req = _view.rootFrame.sendMessage(usContext, "EXECUTE", {code: code});
62 |
63 | req.onreply = function(response) {
64 | var code = 'cordova.callback(' + scId + ', JSON.parse(\'' + JSON.stringify(response.result) + '\'))';
65 | console.warn(code);
66 | cordova.javaScriptExecNeeded(code);
67 | console.warn("RESP:" + JSON.stringify(response));
68 | };
69 | }
70 |
71 | WebView {
72 | width: parent.width
73 | y: urlEntry.height
74 | height: parent.height - y
75 | url: url1
76 | id: _view
77 | onLoadingStateChanged: {
78 | root.exec("InAppBrowser", "loadFinished", [_view.loading])
79 | }
80 | context: WebContext {
81 | id: webcontext
82 |
83 | userScripts: [
84 | UserScript {
85 | context: usContext
86 | emulateGreasemonkey: true
87 | url: "InAppBrowser_escapeScript.js"
88 | }
89 | ]
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/ios/CDVInAppBrowser.h:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | #import
21 | #import
22 | #import
23 |
24 | #ifdef __CORDOVA_4_0_0
25 | #import
26 | #else
27 | #import
28 | #endif
29 |
30 | @class CDVInAppBrowserViewController;
31 |
32 | @interface CDVInAppBrowser : CDVPlugin {
33 | }
34 |
35 | @property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
36 | @property (nonatomic, copy) NSString* callbackId;
37 | @property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
38 |
39 | - (void)open:(CDVInvokedUrlCommand*)command;
40 | - (void)close:(CDVInvokedUrlCommand*)command;
41 | - (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
42 | - (void)show:(CDVInvokedUrlCommand*)command;
43 |
44 | @end
45 |
46 | @interface CDVInAppBrowserOptions : NSObject {}
47 |
48 | @property (nonatomic, assign) BOOL location;
49 | @property (nonatomic, assign) BOOL toolbar;
50 | @property (nonatomic, copy) NSString* closebuttoncaption;
51 | @property (nonatomic, copy) NSString* toolbarposition;
52 | @property (nonatomic, assign) BOOL clearcache;
53 | @property (nonatomic, assign) BOOL clearsessioncache;
54 |
55 | @property (nonatomic, copy) NSString* presentationstyle;
56 | @property (nonatomic, copy) NSString* transitionstyle;
57 |
58 | @property (nonatomic, assign) BOOL enableviewportscale;
59 | @property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
60 | @property (nonatomic, assign) BOOL allowinlinemediaplayback;
61 | @property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
62 | @property (nonatomic, assign) BOOL suppressesincrementalrendering;
63 | @property (nonatomic, assign) BOOL hidden;
64 | @property (nonatomic, assign) BOOL disallowoverscroll;
65 |
66 | + (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
67 |
68 | @end
69 |
70 | @interface CDVInAppBrowserViewController : UIViewController {
71 | @private
72 | NSString* _userAgent;
73 | NSString* _prevUserAgent;
74 | NSInteger _userAgentLockToken;
75 | CDVInAppBrowserOptions *_browserOptions;
76 |
77 | #ifdef __CORDOVA_4_0_0
78 | CDVUIWebViewDelegate* _webViewDelegate;
79 | #else
80 | CDVWebViewDelegate* _webViewDelegate;
81 | #endif
82 |
83 | }
84 |
85 | @property (nonatomic, strong) IBOutlet UIWebView* webView;
86 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
87 | @property (nonatomic, strong) IBOutlet UILabel* addressLabel;
88 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
89 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
90 | @property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
91 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
92 |
93 | @property (nonatomic, weak) id orientationDelegate;
94 | @property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
95 | @property (nonatomic) NSURL* currentURL;
96 |
97 | - (void)close;
98 | - (void)navigateTo:(NSURL*)url;
99 | - (void)showLocationBar:(BOOL)show;
100 | - (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
101 | - (void)setCloseButtonTitle:(NSString*)title;
102 |
103 | - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
104 |
105 | @end
106 |
107 | @interface CDVInAppBrowserNavigationController : UINavigationController
108 |
109 | @property (nonatomic, weak) id orientationDelegate;
110 |
111 | @end
112 |
113 |
--------------------------------------------------------------------------------
/src/ubuntu/inappbrowser.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2013 Canonical Ltd.
4 | *
5 | * Licensed to the Apache Software Foundation (ASF) under one
6 | * or more contributor license agreements. See the NOTICE file
7 | * distributed with this work for additional information
8 | * regarding copyright ownership. The ASF licenses this file
9 | * to you under the Apache License, Version 2.0 (the
10 | * "License"); you may not use this file except in compliance
11 | * with the License. You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing,
16 | * software distributed under the License is distributed on an
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 | * KIND, either express or implied. See the License for the
19 | * specific language governing permissions and limitations
20 | * under the License.
21 | *
22 | */
23 |
24 | #include
25 | #include
26 |
27 | #include "inappbrowser.h"
28 | #include
29 |
30 | Inappbrowser::Inappbrowser(Cordova *cordova): CPlugin(cordova), _eventCb(0) {
31 | }
32 |
33 | const char code[] = "\
34 | var component; \
35 | function createObject() { \
36 | component = Qt.createComponent(%1); \
37 | if (component.status == Component.Ready) \
38 | finishCreation(); \
39 | else \
40 | component.statusChanged.connect(finishCreation); \
41 | } \
42 | function finishCreation() { \
43 | CordovaWrapper.global.inappbrowser = component.createObject(root, \
44 | {root: root, cordova: cordova, url1: %2}); \
45 | } \
46 | createObject()";
47 |
48 | const char EXIT_EVENT[] = "{type: 'exit'}";
49 | const char LOADSTART_EVENT[] = "{type: 'loadstart'}";
50 | const char LOADSTOP_EVENT[] = "{type: 'loadstop'}";
51 | const char LOADERROR_EVENT[] = "{type: 'loaderror'}";
52 |
53 | void Inappbrowser::open(int cb, int, const QString &url, const QString &, const QString &) {
54 | assert(_eventCb == 0);
55 |
56 | _eventCb = cb;
57 |
58 | QString path = m_cordova->get_app_dir() + "/../qml/InAppBrowser.qml";
59 | QString qml = QString(code)
60 | .arg(CordovaInternal::format(path)).arg(CordovaInternal::format(url));
61 | m_cordova->execQML(qml);
62 | }
63 |
64 | void Inappbrowser::show(int, int) {
65 | m_cordova->execQML("CordovaWrapper.global.inappbrowser.visible = true");
66 | }
67 |
68 | void Inappbrowser::close(int, int) {
69 | m_cordova->execQML("CordovaWrapper.global.inappbrowser.destroy()");
70 | this->callbackWithoutRemove(_eventCb, EXIT_EVENT);
71 | _eventCb = 0;
72 | }
73 |
74 | void Inappbrowser::injectStyleFile(int scId, int ecId, const QString& src, bool b) {
75 | QString code("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %1; d.head.appendChild(c);})(document)");
76 | code = code.arg(CordovaInternal::format(src));
77 |
78 | injectScriptCode(scId, ecId, code, b);
79 | }
80 |
81 | void Inappbrowser::injectStyleCode(int scId, int ecId, const QString& src, bool b) {
82 | QString code("(function(d) { var c = d.createElement('style'); c.innerHTML = %1; d.body.appendChild(c); })(document)");
83 | code = code.arg(CordovaInternal::format(src));
84 |
85 | injectScriptCode(scId, ecId, code, b);
86 | }
87 |
88 | void Inappbrowser::injectScriptFile(int scId, int ecId, const QString& src, bool b) {
89 | QString code("(function(d) { var c = d.createElement('script'); c.src = %1; d.body.appendChild(c);})(document)");
90 | code = code.arg(CordovaInternal::format(src));
91 |
92 | injectScriptCode(scId, ecId, code, b);
93 | }
94 |
95 | void Inappbrowser::injectScriptCode(int scId, int, const QString& code, bool) {
96 | m_cordova->execQML(QString("CordovaWrapper.global.inappbrowser.executeJS(%2, %1)").arg(CordovaInternal::format(code)).arg(scId));
97 | }
98 |
99 | void Inappbrowser::loadFinished(bool status) {
100 | if (!status) {
101 | this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT);
102 | } else {
103 | this->callbackWithoutRemove(_eventCb, LOADSTART_EVENT);
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/www/inappbrowser.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | (function() {
23 | // special patch to correctly work on Ripple emulator (CB-9760)
24 | if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
25 | module.exports = window.open.bind(window); // fallback to default window.open behaviour
26 | return;
27 | }
28 |
29 | var exec = require('cordova/exec');
30 | var channel = require('cordova/channel');
31 | var modulemapper = require('cordova/modulemapper');
32 | var urlutil = require('cordova/urlutil');
33 |
34 | function InAppBrowser() {
35 | this.channels = {
36 | 'loadstart': channel.create('loadstart'),
37 | 'loadstop' : channel.create('loadstop'),
38 | 'loaderror' : channel.create('loaderror'),
39 | 'exit' : channel.create('exit')
40 | };
41 | }
42 |
43 | InAppBrowser.prototype = {
44 | _eventHandler: function (event) {
45 | if (event && (event.type in this.channels)) {
46 | this.channels[event.type].fire(event);
47 | }
48 | },
49 | close: function (eventname) {
50 | exec(null, null, "InAppBrowser", "close", []);
51 | },
52 | show: function (eventname) {
53 | exec(null, null, "InAppBrowser", "show", []);
54 | },
55 | addEventListener: function (eventname,f) {
56 | if (eventname in this.channels) {
57 | this.channels[eventname].subscribe(f);
58 | }
59 | },
60 | removeEventListener: function(eventname, f) {
61 | if (eventname in this.channels) {
62 | this.channels[eventname].unsubscribe(f);
63 | }
64 | },
65 |
66 | executeScript: function(injectDetails, cb) {
67 | if (injectDetails.code) {
68 | exec(cb, null, "InAppBrowser", "injectScriptCode", [injectDetails.code, !!cb]);
69 | } else if (injectDetails.file) {
70 | exec(cb, null, "InAppBrowser", "injectScriptFile", [injectDetails.file, !!cb]);
71 | } else {
72 | throw new Error('executeScript requires exactly one of code or file to be specified');
73 | }
74 | },
75 |
76 | insertCSS: function(injectDetails, cb) {
77 | if (injectDetails.code) {
78 | exec(cb, null, "InAppBrowser", "injectStyleCode", [injectDetails.code, !!cb]);
79 | } else if (injectDetails.file) {
80 | exec(cb, null, "InAppBrowser", "injectStyleFile", [injectDetails.file, !!cb]);
81 | } else {
82 | throw new Error('insertCSS requires exactly one of code or file to be specified');
83 | }
84 | }
85 | };
86 |
87 | module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
88 | // Don't catch calls that write to existing frames (e.g. named iframes).
89 | if (window.frames && window.frames[strWindowName]) {
90 | var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
91 | return origOpenFunc.apply(window, arguments);
92 | }
93 |
94 | strUrl = urlutil.makeAbsolute(strUrl);
95 | var iab = new InAppBrowser();
96 |
97 | callbacks = callbacks || {};
98 | for (var callbackName in callbacks) {
99 | iab.addEventListener(callbackName, callbacks[callbackName]);
100 | }
101 |
102 | var cb = function(eventname) {
103 | iab._eventHandler(eventname);
104 | };
105 |
106 | strWindowFeatures = strWindowFeatures || "";
107 |
108 | exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
109 | return iab;
110 | };
111 | })();
112 |
--------------------------------------------------------------------------------
/www/windows8/InAppBrowserProxy.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | /*jslint sloppy:true */
23 | /*global Windows:true, require, document, setTimeout, window, module */
24 |
25 | var browserWrap;
26 |
27 | var IAB = {
28 |
29 | close: function (win, lose) {
30 | if (browserWrap) {
31 | browserWrap.parentNode.removeChild(browserWrap);
32 | browserWrap = null;
33 | }
34 | },
35 | show: function (win, lose) {
36 | /* empty block, ran out of bacon?
37 | if (browserWrap) {
38 |
39 | }*/
40 | },
41 | open: function (win, lose, args) {
42 | var strUrl = args[0],
43 | target = args[1],
44 | url,
45 | elem;
46 |
47 | if (target === "_system") {
48 | url = new Windows.Foundation.Uri(strUrl);
49 | Windows.System.Launcher.launchUriAsync(url);
50 | } else if (target === "_blank") {
51 | if (!browserWrap) {
52 | browserWrap = document.createElement("div");
53 | browserWrap.style.position = "absolute";
54 | browserWrap.style.width = (window.innerWidth - 80) + "px";
55 | browserWrap.style.height = (window.innerHeight - 80) + "px";
56 | browserWrap.style.borderWidth = "40px";
57 | browserWrap.style.borderStyle = "solid";
58 | browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
59 | browserWrap.style.zIndex = "9999999";
60 |
61 | browserWrap.onclick = function () {
62 | setTimeout(function () {
63 | IAB.close();
64 | }, 0);
65 | };
66 |
67 | document.body.appendChild(browserWrap);
68 | }
69 | var localFile = (strUrl.indexOf('ms-appdata:///') > -1);
70 | if (localFile) {
71 | elem = document.createElement("x-ms-webview");
72 | elem.style.width = (window.innerWidth - 80) + "px";
73 | elem.style.height = (window.innerHeight - 80) + "px";
74 | elem.style.borderWidth = "0px";
75 | elem.name = "targetFrame";
76 | elem.src = strUrl;
77 |
78 | window.addEventListener("resize", function () {
79 | if (browserWrap && elem) {
80 | elem.style.width = (window.innerWidth - 80) + "px";
81 | elem.style.height = (window.innerHeight - 80) + "px";
82 | }
83 | });
84 |
85 | } else {
86 | elem = document.createElement("iframe");
87 | elem.style.width = (window.innerWidth - 80) + "px";
88 | elem.style.height = (window.innerHeight - 80) + "px";
89 | elem.style.borderWidth = "0px";
90 | elem.name = "targetFrame";
91 | elem.src = strUrl;
92 |
93 |
94 | window.addEventListener("resize", function () {
95 | if (browserWrap && elem) {
96 | elem.style.width = (window.innerWidth - 80) + "px";
97 | elem.style.height = (window.innerHeight - 80) + "px";
98 | }
99 | });
100 | }
101 |
102 | browserWrap.appendChild(elem);
103 | } else {
104 | window.location = strUrl;
105 | }
106 |
107 | //var object = new WinJS.UI.HtmlControl(elem, { uri: strUrl });
108 |
109 | },
110 |
111 | injectScriptCode: function (code, bCB) {
112 |
113 | // "(function(d) { var c = d.createElement('script'); c.src = %@; d.body.appendChild(c); })(document)"
114 | },
115 |
116 | injectScriptFile: function (file, bCB) {
117 |
118 | }
119 | };
120 |
121 | module.exports = IAB;
122 |
123 |
124 | require("cordova/exec/proxy").add("InAppBrowser", module.exports);
125 |
--------------------------------------------------------------------------------
/src/android/InAppChromeClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.inappbrowser;
20 |
21 | import org.apache.cordova.CordovaWebView;
22 | import org.apache.cordova.LOG;
23 | import org.apache.cordova.PluginResult;
24 | import org.json.JSONArray;
25 | import org.json.JSONException;
26 |
27 | import android.webkit.JsPromptResult;
28 | import android.webkit.WebChromeClient;
29 | import android.webkit.WebStorage;
30 | import android.webkit.WebView;
31 | import android.webkit.WebViewClient;
32 | import android.webkit.GeolocationPermissions.Callback;
33 |
34 | public class InAppChromeClient extends WebChromeClient {
35 |
36 | private CordovaWebView webView;
37 | private String LOG_TAG = "InAppChromeClient";
38 | private long MAX_QUOTA = 100 * 1024 * 1024;
39 |
40 | public InAppChromeClient(CordovaWebView webView) {
41 | super();
42 | this.webView = webView;
43 | }
44 | /**
45 | * Handle database quota exceeded notification.
46 | *
47 | * @param url
48 | * @param databaseIdentifier
49 | * @param currentQuota
50 | * @param estimatedSize
51 | * @param totalUsedQuota
52 | * @param quotaUpdater
53 | */
54 | @Override
55 | public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
56 | long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
57 | {
58 | LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
59 | quotaUpdater.updateQuota(MAX_QUOTA);
60 | }
61 |
62 | /**
63 | * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
64 | *
65 | * @param origin
66 | * @param callback
67 | */
68 | @Override
69 | public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
70 | super.onGeolocationPermissionsShowPrompt(origin, callback);
71 | callback.invoke(origin, true, false);
72 | }
73 |
74 | /**
75 | * Tell the client to display a prompt dialog to the user.
76 | * If the client returns true, WebView will assume that the client will
77 | * handle the prompt dialog and call the appropriate JsPromptResult method.
78 | *
79 | * The prompt bridge provided for the InAppBrowser is capable of executing any
80 | * oustanding callback belonging to the InAppBrowser plugin. Care has been
81 | * taken that other callbacks cannot be triggered, and that no other code
82 | * execution is possible.
83 | *
84 | * To trigger the bridge, the prompt default value should be of the form:
85 | *
86 | * gap-iab://
87 | *
88 | * where is the string id of the callback to trigger (something
89 | * like "InAppBrowser0123456789")
90 | *
91 | * If present, the prompt message is expected to be a JSON-encoded value to
92 | * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid.
93 | *
94 | * @param view
95 | * @param url
96 | * @param message
97 | * @param defaultValue
98 | * @param result
99 | */
100 | @Override
101 | public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
102 | // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute.
103 | if (defaultValue != null && defaultValue.startsWith("gap")) {
104 | if(defaultValue.startsWith("gap-iab://")) {
105 | PluginResult scriptResult;
106 | String scriptCallbackId = defaultValue.substring(10);
107 | if (scriptCallbackId.startsWith("InAppBrowser")) {
108 | if(message == null || message.length() == 0) {
109 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray());
110 | } else {
111 | try {
112 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message));
113 | } catch(JSONException e) {
114 | scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
115 | }
116 | }
117 | this.webView.sendPluginResult(scriptResult, scriptCallbackId);
118 | result.confirm("");
119 | return true;
120 | }
121 | }
122 | else
123 | {
124 | // Anything else with a gap: prefix should get this message
125 | LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " + url + " " + defaultValue);
126 | result.cancel();
127 | return true;
128 | }
129 | }
130 | return false;
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/src/amazon/InAppChromeClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.inappbrowser;
20 |
21 | import org.apache.cordova.CordovaWebView;
22 | import org.apache.cordova.LOG;
23 | import org.apache.cordova.PluginResult;
24 | import org.json.JSONArray;
25 | import org.json.JSONException;
26 |
27 | import com.amazon.android.webkit.AmazonWebChromeClient;
28 | import com.amazon.android.webkit.AmazonGeolocationPermissions.Callback;
29 | import com.amazon.android.webkit.AmazonJsPromptResult;
30 | import com.amazon.android.webkit.AmazonWebStorage;
31 | import com.amazon.android.webkit.AmazonWebView;
32 | import com.amazon.android.webkit.AmazonWebViewClient;
33 |
34 | public class InAppChromeClient extends AmazonWebChromeClient {
35 |
36 | private CordovaWebView webView;
37 | private String LOG_TAG = "InAppChromeClient";
38 | private long MAX_QUOTA = 100 * 1024 * 1024;
39 |
40 | public InAppChromeClient(CordovaWebView webView) {
41 | super();
42 | this.webView = webView;
43 | }
44 | /**
45 | * Handle database quota exceeded notification.
46 | *
47 | * @param url
48 | * @param databaseIdentifier
49 | * @param currentQuota
50 | * @param estimatedSize
51 | * @param totalUsedQuota
52 | * @param quotaUpdater
53 | */
54 | @Override
55 | public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
56 | long totalUsedQuota, AmazonWebStorage.QuotaUpdater quotaUpdater)
57 | {
58 | LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
59 |
60 | if (estimatedSize < MAX_QUOTA)
61 | {
62 | //increase for 1Mb
63 | long newQuota = estimatedSize;
64 | LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
65 | quotaUpdater.updateQuota(newQuota);
66 | }
67 | else
68 | {
69 | // Set the quota to whatever it is and force an error
70 | // TODO: get docs on how to handle this properly
71 | quotaUpdater.updateQuota(currentQuota);
72 | }
73 | }
74 |
75 | /**
76 | * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
77 | *
78 | * @param origin
79 | * @param callback
80 | */
81 | @Override
82 | public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
83 | super.onGeolocationPermissionsShowPrompt(origin, callback);
84 | callback.invoke(origin, true, false);
85 | }
86 |
87 | /**
88 | * Tell the client to display a prompt dialog to the user.
89 | * If the client returns true, WebView will assume that the client will
90 | * handle the prompt dialog and call the appropriate JsPromptResult method.
91 | *
92 | * The prompt bridge provided for the InAppBrowser is capable of executing any
93 | * oustanding callback belonging to the InAppBrowser plugin. Care has been
94 | * taken that other callbacks cannot be triggered, and that no other code
95 | * execution is possible.
96 | *
97 | * To trigger the bridge, the prompt default value should be of the form:
98 | *
99 | * gap-iab://
100 | *
101 | * where is the string id of the callback to trigger (something
102 | * like "InAppBrowser0123456789")
103 | *
104 | * If present, the prompt message is expected to be a JSON-encoded value to
105 | * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid.
106 | *
107 | * @param view
108 | * @param url
109 | * @param message
110 | * @param defaultValue
111 | * @param result
112 | */
113 | @Override
114 | public boolean onJsPrompt(AmazonWebView view, String url, String message, String defaultValue, AmazonJsPromptResult result) {
115 | // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute.
116 | if (defaultValue != null && defaultValue.startsWith("gap")) {
117 | if(defaultValue.startsWith("gap-iab://")) {
118 | PluginResult scriptResult;
119 | String scriptCallbackId = defaultValue.substring(10);
120 | if (scriptCallbackId.startsWith("InAppBrowser")) {
121 | if(message == null || message.length() == 0) {
122 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray());
123 | } else {
124 | try {
125 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message));
126 | } catch(JSONException e) {
127 | scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
128 | }
129 | }
130 | this.webView.sendPluginResult(scriptResult, scriptCallbackId);
131 | result.confirm("");
132 | return true;
133 | }
134 | }
135 | else
136 | {
137 | // Anything else with a gap: prefix should get this message
138 | LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " + url + " " + defaultValue);
139 | result.cancel();
140 | return true;
141 | }
142 | }
143 | return false;
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/src/firefoxos/InAppBrowserProxy.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | // https://developer.mozilla.org/en-US/docs/WebAPI/Browser
23 |
24 | var modulemapper = require('cordova/modulemapper');
25 |
26 | var origOpenFunc = modulemapper.getOriginalSymbol(window, 'window.open');
27 | var browserWrap;
28 |
29 | var IABExecs = {
30 |
31 | close: function (win, lose) {
32 | if (browserWrap) {
33 | browserWrap.parentNode.removeChild(browserWrap);
34 | browserWrap = null;
35 | if (typeof(win) == "function") win({type:'exit'});
36 | }
37 | },
38 |
39 | /*
40 | * Reveal browser if opened hidden
41 | */
42 | show: function (win, lose) {
43 | console.error('[FirefoxOS] show not implemented');
44 | },
45 |
46 | open: function (win, lose, args) {
47 | var strUrl = args[0],
48 | target = args[1],
49 | features_string = args[2] || "location=yes", //location=yes is default
50 | features = {};
51 |
52 | var features_list = features_string.split(',');
53 | features_list.forEach(function(feature) {
54 | var tup = feature.split('=');
55 | if (tup[1] == 'yes') {
56 | tup[1] = true;
57 | } else if (tup[1] == 'no') {
58 | tup[1] = false;
59 | } else {
60 | var number = parseInt(tup[1]);
61 | if (!isNaN(number)) {
62 | tup[1] = number;
63 | }
64 | }
65 | features[tup[0]] = tup[1];
66 | });
67 |
68 | function updateIframeSizeNoLocation() {
69 | browserWrap.style.width = window.innerWidth + 'px';
70 | browserWrap.style.height = window.innerHeight + 'px';
71 | browserWrap.style.zIndex = '999999999';
72 | browserWrap.browser.style.height = (window.innerHeight - 60) + 'px';
73 | browserWrap.browser.style.width = browserWrap.style.width;
74 | }
75 |
76 | if (target === '_system') {
77 | origOpenFunc.apply(window, [strUrl, '_blank']);
78 | } else if (target === '_blank') {
79 | var browserElem = document.createElement('iframe');
80 | browserElem.setAttribute('mozbrowser', true);
81 | // make this loaded in its own child process
82 | browserElem.setAttribute('remote', true);
83 | browserElem.setAttribute('src', strUrl);
84 | if (browserWrap) {
85 | document.body.removeChild(browserWrap);
86 | }
87 | browserWrap = document.createElement('div');
88 | // assign browser element to browserWrap for future reference
89 | browserWrap.browser = browserElem;
90 |
91 | browserWrap.classList.add('inAppBrowserWrap');
92 | // position fixed so that it works even when page is scrolled
93 | browserWrap.style.position = 'fixed';
94 | browserElem.style.position = 'absolute';
95 | browserElem.style.border = 0;
96 | browserElem.style.top = '60px';
97 | browserElem.style.left = '0px';
98 | updateIframeSizeNoLocation();
99 |
100 | var menu = document.createElement('menu');
101 | menu.setAttribute('type', 'toolbar');
102 | var close = document.createElement('li');
103 | var back = document.createElement('li');
104 | var forward = document.createElement('li');
105 |
106 | close.appendChild(document.createTextNode('×'));
107 | back.appendChild(document.createTextNode('<'));
108 | forward.appendChild(document.createTextNode('>'));
109 |
110 | close.classList.add('inAppBrowserClose');
111 | back.classList.add('inAppBrowserBack');
112 | forward.classList.add('inAppBrowserForward');
113 |
114 | var checkForwardBackward = function () {
115 | var backReq = browserElem.getCanGoBack();
116 | backReq.onsuccess = function() {
117 | if (this.result) {
118 | back.classList.remove('disabled');
119 | } else {
120 | back.classList.add('disabled');
121 | }
122 | };
123 | var forwardReq = browserElem.getCanGoForward();
124 | forwardReq.onsuccess = function() {
125 | if (this.result) {
126 | forward.classList.remove('disabled');
127 | } else {
128 | forward.classList.add('disabled');
129 | }
130 | };
131 | };
132 |
133 | browserElem.addEventListener('mozbrowserloadend', checkForwardBackward);
134 |
135 | close.addEventListener('click', function () {
136 | setTimeout(function () {
137 | IABExecs.close(win, lose);
138 | }, 0);
139 | }, false);
140 |
141 | back.addEventListener('click', function () {
142 | browserElem.goBack();
143 | }, false);
144 |
145 | forward.addEventListener('click', function () {
146 | browserElem.goForward();
147 | }, false);
148 |
149 | menu.appendChild(back);
150 | menu.appendChild(forward);
151 | menu.appendChild(close);
152 |
153 | browserWrap.appendChild(menu);
154 | browserWrap.appendChild(browserElem);
155 | document.body.appendChild(browserWrap);
156 |
157 | //we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url
158 | browserElem.addEventListener('mozbrowserlocationchange', function(e){
159 | win({
160 | type:'loadstart',
161 | url : e.detail
162 | });
163 | }, false);
164 | browserElem.addEventListener('mozbrowserloadend', function(e){
165 | win({type:'loadstop'});
166 | }, false);
167 | browserElem.addEventListener('mozbrowsererror', function(e){
168 | win({type:'loaderror'});
169 | }, false);
170 | browserElem.addEventListener('mozbrowserclose', function(e){
171 | win({type:'exit'});
172 | }, false);
173 | } else {
174 | window.location = strUrl;
175 | }
176 | },
177 | injectScriptCode: function (code, bCB) {
178 | console.error('[FirefoxOS] injectScriptCode not implemented');
179 | },
180 | injectScriptFile: function (file, bCB) {
181 | console.error('[FirefoxOS] injectScriptFile not implemented');
182 | }
183 | };
184 |
185 | module.exports = IABExecs;
186 |
187 | require('cordova/exec/proxy').add('InAppBrowser', module.exports);
188 |
--------------------------------------------------------------------------------
/src/browser/InAppBrowserProxy.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | var modulemapper = require('cordova/modulemapper');
23 |
24 | var browserWrap,
25 | popup,
26 | navigationButtonsDiv,
27 | navigationButtonsDivInner,
28 | backButton,
29 | forwardButton,
30 | closeButton;
31 |
32 | function attachNavigationEvents(element, callback) {
33 | var onError = function () {
34 | callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true});
35 | };
36 |
37 | element.addEventListener("pageshow", function () {
38 | callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true});
39 | });
40 |
41 | element.addEventListener("load", function () {
42 | callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true});
43 | });
44 |
45 | element.addEventListener("error", onError);
46 | element.addEventListener("abort", onError);
47 | }
48 |
49 | var IAB = {
50 | close: function (win, lose) {
51 | if (browserWrap) {
52 | if (win) win({ type: "exit" });
53 |
54 | browserWrap.parentNode.removeChild(browserWrap);
55 | browserWrap = null;
56 | popup = null;
57 | }
58 | },
59 |
60 | show: function (win, lose) {
61 | if (browserWrap) {
62 | browserWrap.style.display = "block";
63 | }
64 | },
65 |
66 | open: function (win, lose, args) {
67 | var strUrl = args[0],
68 | target = args[1],
69 | features = args[2];
70 |
71 | if (target === "_self" || !target) {
72 | window.location = strUrl;
73 | } else if (target === "_system") {
74 | modulemapper.getOriginalSymbol(window, 'window.open').call(window, strUrl, "_blank");
75 | } else {
76 | // "_blank" or anything else
77 | if (!browserWrap) {
78 | browserWrap = document.createElement("div");
79 | browserWrap.style.position = "absolute";
80 | browserWrap.style.top = "0";
81 | browserWrap.style.left = "0";
82 | browserWrap.style.boxSizing = "border-box";
83 | browserWrap.style.borderWidth = "40px";
84 | browserWrap.style.width = "100vw";
85 | browserWrap.style.height = "100vh";
86 | browserWrap.style.borderStyle = "solid";
87 | browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
88 |
89 | browserWrap.onclick = function () {
90 | setTimeout(function () {
91 | IAB.close(win);
92 | }, 0);
93 | };
94 |
95 | document.body.appendChild(browserWrap);
96 | }
97 |
98 | if (features.indexOf("hidden=yes") !== -1) {
99 | browserWrap.style.display = "none";
100 | }
101 |
102 | popup = document.createElement("iframe");
103 | popup.style.borderWidth = "0px";
104 | popup.style.width = "100%";
105 |
106 | browserWrap.appendChild(popup);
107 |
108 | if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) {
109 | popup.style.height = "calc(100% - 60px)";
110 | popup.style.marginBottom = "-4px";
111 |
112 | navigationButtonsDiv = document.createElement("div");
113 | navigationButtonsDiv.style.height = "60px";
114 | navigationButtonsDiv.style.backgroundColor = "#404040";
115 | navigationButtonsDiv.style.zIndex = "999";
116 | navigationButtonsDiv.onclick = function (e) {
117 | e.cancelBubble = true;
118 | };
119 |
120 | navigationButtonsDivInner = document.createElement("div");
121 | navigationButtonsDivInner.style.paddingTop = "10px";
122 | navigationButtonsDivInner.style.height = "50px";
123 | navigationButtonsDivInner.style.width = "160px";
124 | navigationButtonsDivInner.style.margin = "0 auto";
125 | navigationButtonsDivInner.style.backgroundColor = "#404040";
126 | navigationButtonsDivInner.style.zIndex = "999";
127 | navigationButtonsDivInner.onclick = function (e) {
128 | e.cancelBubble = true;
129 | };
130 |
131 |
132 | backButton = document.createElement("button");
133 | backButton.style.width = "40px";
134 | backButton.style.height = "40px";
135 | backButton.style.borderRadius = "40px";
136 |
137 | backButton.innerHTML = "←";
138 | backButton.addEventListener("click", function (e) {
139 | if (popup.canGoBack)
140 | popup.goBack();
141 | });
142 |
143 | forwardButton = document.createElement("button");
144 | forwardButton.style.marginLeft = "20px";
145 | forwardButton.style.width = "40px";
146 | forwardButton.style.height = "40px";
147 | forwardButton.style.borderRadius = "40px";
148 |
149 | forwardButton.innerHTML = "→";
150 | forwardButton.addEventListener("click", function (e) {
151 | if (popup.canGoForward)
152 | popup.goForward();
153 | });
154 |
155 | closeButton = document.createElement("button");
156 | closeButton.style.marginLeft = "20px";
157 | closeButton.style.width = "40px";
158 | closeButton.style.height = "40px";
159 | closeButton.style.borderRadius = "40px";
160 |
161 | closeButton.innerHTML = "✖";
162 | closeButton.addEventListener("click", function (e) {
163 | setTimeout(function () {
164 | IAB.close(win);
165 | }, 0);
166 | });
167 |
168 | // iframe navigation is not yet supported
169 | backButton.disabled = true;
170 | forwardButton.disabled = true;
171 |
172 | navigationButtonsDivInner.appendChild(backButton);
173 | navigationButtonsDivInner.appendChild(forwardButton);
174 | navigationButtonsDivInner.appendChild(closeButton);
175 | navigationButtonsDiv.appendChild(navigationButtonsDivInner);
176 |
177 | browserWrap.appendChild(navigationButtonsDiv);
178 | } else {
179 | popup.style.height = "100%";
180 | }
181 |
182 | // start listening for navigation events
183 | attachNavigationEvents(popup, win);
184 |
185 | popup.src = strUrl;
186 | }
187 | },
188 |
189 | injectScriptCode: function (win, fail, args) {
190 | var code = args[0],
191 | hasCallback = args[1];
192 |
193 | if (browserWrap && popup) {
194 | try {
195 | popup.contentWindow.eval(code);
196 | if (hasCallback) {
197 | win([]);
198 | }
199 | } catch(e) {
200 | console.error('Error occured while trying to injectScriptCode: ' + JSON.stringify(e));
201 | }
202 | }
203 | },
204 |
205 | injectScriptFile: function (win, fail, args) {
206 | var msg = 'Browser cordova-plugin-inappbrowser injectScriptFile is not yet implemented';
207 | console.warn(msg);
208 | if (fail) {
209 | fail(msg);
210 | }
211 | },
212 |
213 | injectStyleCode: function (win, fail, args) {
214 | var msg = 'Browser cordova-plugin-inappbrowser injectStyleCode is not yet implemented';
215 | console.warn(msg);
216 | if (fail) {
217 | fail(msg);
218 | }
219 | },
220 |
221 | injectStyleFile: function (win, fail, args) {
222 | var msg = 'Browser cordova-plugin-inappbrowser injectStyleFile is not yet implemented';
223 | console.warn(msg);
224 | if (fail) {
225 | fail(msg);
226 | }
227 | }
228 | };
229 |
230 | module.exports = IAB;
231 |
232 | require("cordova/exec/proxy").add("InAppBrowser", module.exports);
233 |
--------------------------------------------------------------------------------
/doc/zh/index.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | 這個外掛程式提供了一個 web 瀏覽器視圖,顯示在調用 `cordova.InAppBrowser.open()`.
23 |
24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
25 |
26 |
27 | `cordova.InAppBrowser.open()` 函數被定義為一個臨時替代 `window.open ()` 函數。 現有 `window.open ()` 調用,可以通過替換 window.open 使用 InAppBrowser 視窗:
28 |
29 | window.open = cordova.InAppBrowser.open;
30 |
31 |
32 | InAppBrowser 視窗像一個標準的 web 瀏覽器中,並且無法訪問科爾多瓦 Api。 為此,建議 InAppBrowser 如果您需要載入協力廠商 (不可信) 的內容,而不是載入,進入主要的科爾多瓦 web 視圖。 InAppBrowser 是不受白名單中,也不在系統瀏覽器中打開的連結。
33 |
34 | InAppBrowser 預設情況下它自己的 GUI 控制項為使用者提供 (後退、 前進、 完成)。
35 |
36 | 為向後相容性,此外掛程式還鉤 `window.open`。 然而,`window.open` 外掛程式安裝鉤子可以有副作用 (尤其是如果這個外掛程式是只列為另一個外掛程式的依賴項)。 在未來的主要發行版本中,將刪除 `window.open` 鉤。 一直至從該外掛程式鉤子後,應用程式可以手動還原預設行為:
37 |
38 | delete window.open // Reverts the call back to it's prototype's default
39 |
40 |
41 | 雖然 `window.open` 在全球範圍內,InAppBrowser 不可用直到 `deviceready` 事件之後。
42 |
43 | document.addEventListener("deviceready", onDeviceReady, false);
44 | function onDeviceReady() {
45 | console.log("window.open works well");
46 | }
47 |
48 |
49 | ## 安裝
50 |
51 | cordova plugin add cordova-plugin-inappbrowser
52 |
53 |
54 | 如果您希望所有頁面載入中您的應用程式要通過 InAppBrowser,你可以簡單地在初始化過程中鉤 `window.open`。舉個例子:
55 |
56 | document.addEventListener("deviceready", onDeviceReady, false);
57 | function onDeviceReady() {
58 | window.open = cordova.InAppBrowser.open;
59 | }
60 |
61 |
62 | ## cordova.InAppBrowser.open
63 |
64 | 在新的 `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器中打開的 URL。
65 |
66 | var ref = cordova.InAppBrowser.open(url, target, options);
67 |
68 |
69 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
70 |
71 | * **url**: 要載入*(字串)*的 URL。調用 `encodeURI()` 這個如果 URL 包含 Unicode 字元。
72 |
73 | * **target**: 目標在其中載入的 URL,可選參數,預設值為 `_self` 。*(字串)*
74 |
75 | * `_self`: 打開在科爾多瓦 web 視圖如果 URL 是在白名單中,否則它在打開`InAppBrowser`.
76 | * `_blank`: 在打開`InAppBrowser`.
77 | * `_system`: 在該系統的 web 瀏覽器中打開。
78 |
79 | * **options**: 選項為 `InAppBrowser` 。可選,拖欠到: `location=yes` 。*(字串)*
80 |
81 | `options`字串必須不包含任何空白的空間,和必須用逗號分隔每個功能的名稱/值對。 功能名稱區分大小寫。 所有平臺都支援下面的值:
82 |
83 | * **location**: 設置為 `yes` 或 `no` ,打開 `InAppBrowser` 的位置欄打開或關閉。
84 |
85 | Android 系統只有:
86 |
87 | * **hidden**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。
88 | * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗
89 | * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗
90 |
91 | 只有 iOS:
92 |
93 | * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。請注意您需要對此值進行當地語系化你自己。
94 | * **disallowoverscroll**: 將設置為 `yes` 或 `no` (預設值是 `no` )。打開/關閉的 UIWebViewBounce 屬性。
95 | * **hidden**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。
96 | * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗
97 | * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗
98 | * **toolbar**: 設置為 `yes` 或 `no` ,為 InAppBrowser (預設為打開或關閉工具列`yes`)
99 | * **enableViewportScale**: 將設置為 `yes` 或 `no` ,防止通過 meta 標記 (預設為縮放的視區`no`).
100 | * **mediaPlaybackRequiresUserAction**: 將設置為 `yes` 或 `no` ,防止 HTML5 音訊或視頻從 autoplaying (預設為`no`).
101 | * **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`)
102 | * **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`).
103 | * **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`).
104 | * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][1](預設為`fullscreen`).
105 | * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][2](預設為`coververtical`).
106 | * **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。
107 |
108 | 僅限 Windows:
109 |
110 | * **hidden**: 將設置為 `yes` ,創建瀏覽器並載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或被設置為 `no` (預設值),有的瀏覽器打開,以正常方式載入。
111 |
112 | [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
113 | [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
114 |
115 | ### 支援的平臺
116 |
117 | * 亞馬遜火 OS
118 | * Android 系統
119 | * 黑莓 10
120 | * 火狐瀏覽器的作業系統
121 | * iOS
122 | * Windows 8 和 8.1
123 | * Windows Phone 7 和 8
124 |
125 | ### 示例
126 |
127 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
128 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
129 |
130 |
131 | ### 火狐瀏覽器作業系統的怪癖
132 |
133 | 外掛程式不會強制任何設計是需要添加一些 CSS 規則,如果打開與 `target=_blank`。規則 》 可能看起來像這些
134 |
135 | css
136 | .inAppBrowserWrap {
137 | background-color: rgba(0,0,0,0.75);
138 | color: rgba(235,235,235,1.0);
139 | }
140 | .inAppBrowserWrap menu {
141 | overflow: auto;
142 | list-style-type: none;
143 | padding-left: 0;
144 | }
145 | .inAppBrowserWrap menu li {
146 | font-size: 25px;
147 | height: 25px;
148 | float: left;
149 | margin: 0 10px;
150 | padding: 3px 10px;
151 | text-decoration: none;
152 | color: #ccc;
153 | display: block;
154 | background: rgba(30,30,30,0.50);
155 | }
156 | .inAppBrowserWrap menu li.disabled {
157 | color: #777;
158 | }
159 |
160 |
161 | ## InAppBrowser
162 |
163 | 對 `科爾多瓦的調用返回的物件。InAppBrowser.open`.
164 |
165 | ### 方法
166 |
167 | * addEventListener
168 | * removeEventListener
169 | * close
170 | * show
171 | * executeScript
172 | * insertCSS
173 |
174 | ## addEventListener
175 |
176 | > 為事件添加一個攔截器`InAppBrowser`.
177 |
178 | ref.addEventListener(eventname, callback);
179 |
180 |
181 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
182 |
183 | * **eventname**: 事件偵聽*(字串)*
184 |
185 | * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。
186 | * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。
187 | * **loaderror**: 當觸發事件 `InAppBrowser` 載入 URL 時遇到錯誤。
188 | * **exit**: 當觸發事件 `InAppBrowser` 關閉視窗。
189 |
190 | * **callback**: 執行時觸發該事件的函數。該函數通過 `InAppBrowserEvent` 物件作為參數。
191 |
192 | ### InAppBrowserEvent 屬性
193 |
194 | * **type**: eventname,或者 `loadstart` , `loadstop` , `loaderror` ,或 `exit` 。*(字串)*
195 |
196 | * **url**: 已載入的 URL。*(字串)*
197 |
198 | * **code**: 僅中的情況的錯誤代碼 `loaderror` 。*(人數)*
199 |
200 | * **message**: 該錯誤訊息,只有在的情況下 `loaderror` 。*(字串)*
201 |
202 | ### 支援的平臺
203 |
204 | * 亞馬遜火 OS
205 | * Android 系統
206 | * iOS
207 | * Windows 8 和 8.1
208 | * Windows Phone 7 和 8
209 |
210 | ### 快速的示例
211 |
212 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
213 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
214 |
215 |
216 | ## removeEventListener
217 |
218 | > 移除的事件攔截器`InAppBrowser`.
219 |
220 | ref.removeEventListener(eventname, callback);
221 |
222 |
223 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
224 |
225 | * **eventname**: 要停止偵聽的事件。*(字串)*
226 |
227 | * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。
228 | * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。
229 | * **loaderror**: 當觸發事件 `InAppBrowser` 遇到錯誤載入一個 URL。
230 | * **exit**: 當觸發事件 `InAppBrowser` 關閉視窗。
231 |
232 | * **callback**: 要在事件觸發時執行的函數。該函數通過 `InAppBrowserEvent` 物件。
233 |
234 | ### 支援的平臺
235 |
236 | * 亞馬遜火 OS
237 | * Android 系統
238 | * iOS
239 | * Windows 8 和 8.1
240 | * Windows Phone 7 和 8
241 |
242 | ### 快速的示例
243 |
244 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
245 | var myCallback = function(event) { alert(event.url); }
246 | ref.addEventListener('loadstart', myCallback);
247 | ref.removeEventListener('loadstart', myCallback);
248 |
249 |
250 | ## close
251 |
252 | > 關閉 `InAppBrowser` 視窗。
253 |
254 | ref.close();
255 |
256 |
257 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
258 |
259 | ### 支援的平臺
260 |
261 | * 亞馬遜火 OS
262 | * Android 系統
263 | * 火狐瀏覽器的作業系統
264 | * iOS
265 | * Windows 8 和 8.1
266 | * Windows Phone 7 和 8
267 |
268 | ### 快速的示例
269 |
270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
271 | ref.close();
272 |
273 |
274 | ## show
275 |
276 | > 顯示打開了隱藏的 InAppBrowser 視窗。調用這沒有任何影響,如果 InAppBrowser 是已經可見。
277 |
278 | ref.show();
279 |
280 |
281 | * **ref**: InAppBrowser 視窗 (參考`InAppBrowser`)
282 |
283 | ### 支援的平臺
284 |
285 | * 亞馬遜火 OS
286 | * Android 系統
287 | * iOS
288 | * Windows 8 和 8.1
289 |
290 | ### 快速的示例
291 |
292 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
293 | // some time later...
294 | ref.show();
295 |
296 |
297 | ## executeScript
298 |
299 | > 注入到 JavaScript 代碼 `InAppBrowser` 視窗
300 |
301 | ref.executeScript(details, callback);
302 |
303 |
304 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
305 |
306 | * **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)*
307 |
308 | * **檔**: 腳本的 URL 來注入。
309 | * **代碼**: 要注入腳本的文本。
310 |
311 | * **回檔**: 執行後注入的 JavaScript 代碼的函數。
312 |
313 | * 如果插入的腳本的類型 `code` ,回檔執行使用單個參數,這是該腳本的傳回值,裹在 `Array` 。 對於多行腳本,這是最後一條語句或最後計算的運算式的傳回值。
314 |
315 | ### 支援的平臺
316 |
317 | * 亞馬遜火 OS
318 | * Android 系統
319 | * iOS
320 | * Windows 8 和 8.1
321 |
322 | ### 快速的示例
323 |
324 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
325 | ref.addEventListener('loadstop', function() {
326 | ref.executeScript({file: "myscript.js"});
327 | });
328 |
329 |
330 | ## insertCSS
331 |
332 | > 注入到 CSS `InAppBrowser` 視窗。
333 |
334 | ref.insertCSS(details, callback);
335 |
336 |
337 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
338 |
339 | * **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)*
340 |
341 | * **file**: 樣式表的 URL 來注入。
342 | * **code**: 文本樣式表的注入。
343 |
344 | * **callback**: 在 CSS 注射後執行的函數。
345 |
346 | ### 支援的平臺
347 |
348 | * 亞馬遜火 OS
349 | * Android 系統
350 | * iOS
351 |
352 | ### 快速的示例
353 |
354 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
355 | ref.addEventListener('loadstop', function() {
356 | ref.insertCSS({file: "mystyles.css"});
357 | });
358 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/doc/ko/index.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | 이 플러그인 `코르도바를 호출할 때 표시 하는 웹 브라우저 보기를 제공 합니다.InAppBrowser.open()`.
23 |
24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
25 |
26 |
27 | `코르도바입니다.InAppBrowser.open()` 함수 `window.open ()` 함수에 대 한 대체품 정의 됩니다. 기존의 `window.open ()` 호출 window.open을 대체 하 여 InAppBrowser 윈도우를 사용할 수 있습니다.
28 |
29 | window.open = cordova.InAppBrowser.open;
30 |
31 |
32 | InAppBrowser 창 표준 웹 브라우저 처럼 동작 및 코르도바 Api에 액세스할 수 없습니다. 이 이유는 InAppBrowser는 것이 좋습니다는 주요 코르도바 webview로 로드 하는 대신 제 3 자 (신뢰할 수 없는) 콘텐츠를 로드 해야 할 경우. InAppBrowser는 허용 될 수도 시스템 브라우저에서 링크를 여는.
33 |
34 | 사용자에 대 한 자체 GUI 컨트롤에서 기본적으로 제공 된 InAppBrowser (뒤로, 앞으로, 완료).
35 |
36 | 대 한 뒤 호환성,이 플러그인도 `window.open` 후크. 그러나, `window.open`의 플러그인 설치 후크를 가질 수 있습니다 의도 하지 않은 부작용 (특히 경우이 플러그인이 다른 플러그인 종속성 으로만 포함). `window.open` 후크 주요 릴리스에서 제거 됩니다. 후크 플러그인에서 제거 될 때까지 애플 리 케이 션 수 있습니다 수동으로 기본 동작을 복원 하 게 됩니다.
37 |
38 | delete window.open // Reverts the call back to it's prototype's default
39 |
40 |
41 | `window.open` 전역 범위에 있지만 InAppBrowser 제공 되지 않습니다 때까지 `deviceready` 이벤트 후.
42 |
43 | document.addEventListener("deviceready", onDeviceReady, false);
44 | function onDeviceReady() {
45 | console.log("window.open works well");
46 | }
47 |
48 |
49 | ## 설치
50 |
51 | cordova plugin add cordova-plugin-inappbrowser
52 |
53 |
54 | InAppBrowser를 통해가 서 당신의 애플 리 케이 션에서 모든 페이지를 로드 하려는 경우 초기화 하는 동안 `window.open` 간단 하 게 연결할 수 있습니다. 예를 들어:
55 |
56 | document.addEventListener("deviceready", onDeviceReady, false);
57 | function onDeviceReady() {
58 | window.open = cordova.InAppBrowser.open;
59 | }
60 |
61 |
62 | ## cordova.InAppBrowser.open
63 |
64 | 새 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저에서 URL을 엽니다.
65 |
66 | var ref = cordova.InAppBrowser.open(url, target, options);
67 |
68 |
69 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
70 |
71 | * **url**: *(문자열)를*로드 하는 URL. 전화 `encodeURI()` 이 경우에는 URL 유니코드 문자를 포함 합니다.
72 |
73 | * **대상**: 대상 URL, 기본적으로 선택적 매개 변수를 로드 하는 `_self` . *(문자열)*
74 |
75 | * `_self`: URL 화이트 리스트에 있으면 코르도바 WebView에서 열리고, 그렇지 않으면 열에`InAppBrowser`.
76 | * `_blank`: 준공에`InAppBrowser`.
77 | * `_system`: 시스템의 웹 브라우저에서 엽니다.
78 |
79 | * **옵션**: 옵션은 `InAppBrowser` . 선택적, 디폴트에: `location=yes` . *(문자열)*
80 |
81 | `options`문자열 텅 빈 어떤 스페이스 포함 해서는 안 그리고 쉼표 각 기능의 이름/값 쌍을 구분 합니다. 기능 이름은 대/소문자입니다. 모든 플랫폼 지원 아래 값:
82 |
83 | * **위치**: 설정 `yes` 또는 `no` 설정 하는 `InAppBrowser` 의 위치 표시줄 켜거나 끕니다.
84 |
85 | 안 드 로이드만:
86 |
87 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
88 | * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다
89 | * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다
90 |
91 | iOS만:
92 |
93 | * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. 참고 직접이 값을 지역화 해야 합니다.
94 | * **disallowoverscroll**: 설정 `yes` 또는 `no` (기본값은 `no` ). 회전 온/오프 UIWebViewBounce 속성입니다.
95 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
96 | * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다
97 | * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다
98 | * **도구 모음**: 설정 `yes` 또는 `no` InAppBrowser (기본값:에 대 한 도구 모음 온 / 오프를 돌기 위하여`yes`)
99 | * **enableViewportScale**: 설정 `yes` 또는 `no` 뷰포트 메타 태그 (기본값:를 통해 확장을 방지 하기 위해`no`).
100 | * **mediaPlaybackRequiresUserAction**: 설정 `yes` 또는 `no` HTML5 오디오 또는 비디오 자동 재생 (기본값에서에서 방지 하기 위해`no`).
101 | * **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`)
102 | * **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`).
103 | * **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`).
104 | * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][1] (기본값을 설정 하려면`fullscreen`).
105 | * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][2] (기본값을 설정 하려면`coververtical`).
106 | * **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다.
107 |
108 | Windows에만 해당:
109 |
110 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
111 |
112 | [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
113 | [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
114 |
115 | ### 지원 되는 플랫폼
116 |
117 | * 아마존 화재 운영 체제
118 | * 안 드 로이드
119 | * 블랙베리 10
120 | * Firefox 운영 체제
121 | * iOS
122 | * 윈도우 8과 8.1
123 | * Windows Phone 7과 8
124 |
125 | ### 예를 들어
126 |
127 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
128 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
129 |
130 |
131 | ### 파이어 폭스 OS 단점
132 |
133 | 플러그인 어떤 디자인을 적용 하지 않는 경우 열 일부 CSS의 규칙을 추가할 필요가 있다 `target='_blank'`. 이 같이 규칙
134 |
135 | css
136 | .inAppBrowserWrap {
137 | background-color: rgba(0,0,0,0.75);
138 | color: rgba(235,235,235,1.0);
139 | }
140 | .inAppBrowserWrap menu {
141 | overflow: auto;
142 | list-style-type: none;
143 | padding-left: 0;
144 | }
145 | .inAppBrowserWrap menu li {
146 | font-size: 25px;
147 | height: 25px;
148 | float: left;
149 | margin: 0 10px;
150 | padding: 3px 10px;
151 | text-decoration: none;
152 | color: #ccc;
153 | display: block;
154 | background: rgba(30,30,30,0.50);
155 | }
156 | .inAppBrowserWrap menu li.disabled {
157 | color: #777;
158 | }
159 |
160 |
161 | ## InAppBrowser
162 |
163 | `Cordova에 대 한 호출에서 반환 하는 개체.InAppBrowser.open`.
164 |
165 | ### 메서드
166 |
167 | * addEventListener
168 | * removeEventListener
169 | * close
170 | * show
171 | * executeScript
172 | * insertCSS
173 |
174 | ## addEventListener
175 |
176 | > 이벤트에 대 한 수신기를 추가 합니다`InAppBrowser`.
177 |
178 | ref.addEventListener(eventname, callback);
179 |
180 |
181 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
182 |
183 | * **eventname**: *(문자열)를* 수신 하도록 이벤트
184 |
185 | * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다.
186 | * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료.
187 | * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL을 로드할 때 오류가 발생 합니다.
188 | * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다.
189 |
190 | * **콜백**: 이벤트가 발생 될 때 실행 되는 함수. 함수는 전달 된 `InAppBrowserEvent` 개체를 매개 변수로 합니다.
191 |
192 | ### InAppBrowserEvent 속성
193 |
194 | * **유형**: eventname, 중 `loadstart` , `loadstop` , `loaderror` , 또는 `exit` . *(문자열)*
195 |
196 | * **url**: URL 로드 된. *(문자열)*
197 |
198 | * **코드**: 오류 코드의 경우에만 `loaderror` . *(수)*
199 |
200 | * **메시지**: 오류 메시지의 경우에만 `loaderror` . *(문자열)*
201 |
202 | ### 지원 되는 플랫폼
203 |
204 | * 아마존 화재 운영 체제
205 | * 안 드 로이드
206 | * iOS
207 | * 윈도우 8과 8.1
208 | * Windows Phone 7과 8
209 |
210 | ### 빠른 예제
211 |
212 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
213 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
214 |
215 |
216 | ## removeEventListener
217 |
218 | > 이벤트에 대 한 수신기를 제거 합니다`InAppBrowser`.
219 |
220 | ref.removeEventListener(eventname, callback);
221 |
222 |
223 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
224 |
225 | * **eventname**: 이벤트 수신 대기를 중지 합니다. *(문자열)*
226 |
227 | * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다.
228 | * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료.
229 | * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL 로드 오류가 발생 합니다.
230 | * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다.
231 |
232 | * **콜백**: 이벤트가 발생 하면 실행할 함수. 함수는 전달 된 `InAppBrowserEvent` 개체.
233 |
234 | ### 지원 되는 플랫폼
235 |
236 | * 아마존 화재 운영 체제
237 | * 안 드 로이드
238 | * iOS
239 | * 윈도우 8과 8.1
240 | * Windows Phone 7과 8
241 |
242 | ### 빠른 예제
243 |
244 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
245 | var myCallback = function(event) { alert(event.url); }
246 | ref.addEventListener('loadstart', myCallback);
247 | ref.removeEventListener('loadstart', myCallback);
248 |
249 |
250 | ## close
251 |
252 | > 종료는 `InAppBrowser` 창.
253 |
254 | ref.close();
255 |
256 |
257 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
258 |
259 | ### 지원 되는 플랫폼
260 |
261 | * 아마존 화재 운영 체제
262 | * 안 드 로이드
263 | * Firefox 운영 체제
264 | * iOS
265 | * 윈도우 8과 8.1
266 | * Windows Phone 7과 8
267 |
268 | ### 빠른 예제
269 |
270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
271 | ref.close();
272 |
273 |
274 | ## show
275 |
276 | > 숨겨진 열은 한 InAppBrowser 창을 표시 합니다. 전화는 InAppBrowser가 이미 보이는 경우는 효과가 없습니다.
277 |
278 | ref.show();
279 |
280 |
281 | * **ref**: InAppBrowser 창 (참조`InAppBrowser`)
282 |
283 | ### 지원 되는 플랫폼
284 |
285 | * 아마존 화재 운영 체제
286 | * 안 드 로이드
287 | * iOS
288 | * 윈도우 8과 8.1
289 |
290 | ### 빠른 예제
291 |
292 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
293 | // some time later...
294 | ref.show();
295 |
296 |
297 | ## executeScript
298 |
299 | > 에 자바 스크립트 코드를 삽입는 `InAppBrowser` 창
300 |
301 | ref.executeScript(details, callback);
302 |
303 |
304 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
305 |
306 | * **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)*
307 |
308 | * **파일**: 삽입 하는 스크립트의 URL.
309 | * **코드**: 스크립트 텍스트를 삽입 합니다.
310 |
311 | * **콜백**: 자바 스크립트 코드를 주입 후 실행 기능.
312 |
313 | * 삽입 된 스크립트 유형의 경우 `code` , 스크립트의 반환 값은 단일 매개 변수는 콜백 실행에 싸여 있는 `Array` . 여러 줄 스크립트에 대 한 마지막 문 또는 평가 마지막 식의 반환 값입니다.
314 |
315 | ### 지원 되는 플랫폼
316 |
317 | * 아마존 화재 운영 체제
318 | * 안 드 로이드
319 | * iOS
320 | * 윈도우 8과 8.1
321 |
322 | ### 빠른 예제
323 |
324 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
325 | ref.addEventListener('loadstop', function() {
326 | ref.executeScript({file: "myscript.js"});
327 | });
328 |
329 |
330 | ## insertCSS
331 |
332 | > 주사로 CSS는 `InAppBrowser` 창.
333 |
334 | ref.insertCSS(details, callback);
335 |
336 |
337 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
338 |
339 | * **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)*
340 |
341 | * **파일**: 삽입 하는 스타일 시트의 URL.
342 | * **코드**: 삽입 하는 스타일 시트의 텍스트.
343 |
344 | * **콜백**: CSS 주입 후 실행 기능.
345 |
346 | ### 지원 되는 플랫폼
347 |
348 | * 아마존 화재 운영 체제
349 | * 안 드 로이드
350 | * iOS
351 |
352 | ### 빠른 예제
353 |
354 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
355 | ref.addEventListener('loadstop', function() {
356 | ref.insertCSS({file: "mystyles.css"});
357 | });
358 |
--------------------------------------------------------------------------------
/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
24 |
25 | InAppBrowser
26 | Cordova InAppBrowser Plugin
27 | Apache 2.0
28 | cordova,in,app,browser,inappbrowser
29 | https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
30 | https://issues.apache.org/jira/browse/CB/component/12320641
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
--------------------------------------------------------------------------------
/doc/zh/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | [](https://travis-ci.org/apache/cordova-plugin-inappbrowser)
23 |
24 | 這個外掛程式提供了一個 web 瀏覽器視圖,顯示在調用 `cordova.InAppBrowser.open()`.
25 |
26 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
27 |
28 |
29 | `cordova.InAppBrowser.open()` 函數被定義為一個臨時替代 `window.open ()` 函數。 現有 `window.open ()` 調用,可以通過替換 window.open 使用 InAppBrowser 視窗:
30 |
31 | window.open = cordova.InAppBrowser.open;
32 |
33 |
34 | InAppBrowser 視窗像一個標準的 web 瀏覽器中,並且無法訪問科爾多瓦 Api。 為此,建議 InAppBrowser 如果您需要載入協力廠商 (不可信) 的內容,而不是載入,進入主要的科爾多瓦 web 視圖。 InAppBrowser 是不受白名單中,也不在系統瀏覽器中打開的連結。
35 |
36 | InAppBrowser 預設情況下它自己的 GUI 控制項為使用者提供 (後退、 前進、 完成)。
37 |
38 | 為向後相容性,此外掛程式還鉤 `window.open`。 然而,`window.open` 外掛程式安裝鉤子可以有副作用 (尤其是如果這個外掛程式是只列為另一個外掛程式的依賴項)。 在未來的主要發行版本中,將刪除 `window.open` 鉤。 一直至從該外掛程式鉤子後,應用程式可以手動還原預設行為:
39 |
40 | delete window.open // Reverts the call back to it's prototype's default
41 |
42 |
43 | 雖然 `window.open` 在全球範圍內,InAppBrowser 不可用直到 `deviceready` 事件之後。
44 |
45 | document.addEventListener("deviceready", onDeviceReady, false);
46 | function onDeviceReady() {
47 | console.log("window.open works well");
48 | }
49 |
50 |
51 | ## 安裝
52 |
53 | cordova plugin add cordova-plugin-inappbrowser
54 |
55 |
56 | 如果您希望所有頁面載入中您的應用程式要通過 InAppBrowser,你可以簡單地在初始化過程中鉤 `window.open`。舉個例子:
57 |
58 | document.addEventListener("deviceready", onDeviceReady, false);
59 | function onDeviceReady() {
60 | window.open = cordova.InAppBrowser.open;
61 | }
62 |
63 |
64 | ## cordova.InAppBrowser.open
65 |
66 | 在新的 `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器中打開的 URL。
67 |
68 | var ref = cordova.InAppBrowser.open(url, target, options);
69 |
70 |
71 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
72 |
73 | * **url**: 要載入*(字串)*的 URL。調用 `encodeURI()` 這個如果 URL 包含 Unicode 字元。
74 |
75 | * **target**: 目標在其中載入的 URL,可選參數,預設值為 `_self` 。*(字串)*
76 |
77 | * `_self`: 打開在科爾多瓦 web 視圖如果 URL 是在白名單中,否則它在打開`InAppBrowser`.
78 | * `_blank`: 在打開`InAppBrowser`.
79 | * `_system`: 在該系統的 web 瀏覽器中打開。
80 |
81 | * **options**: 選項為 `InAppBrowser` 。可選,拖欠到: `location=yes` 。*(字串)*
82 |
83 | `options`字串必須不包含任何空白的空間,和必須用逗號分隔每個功能的名稱/值對。 功能名稱區分大小寫。 所有平臺都支援下面的值:
84 |
85 | * **location**: 設置為 `yes` 或 `no` ,打開 `InAppBrowser` 的位置欄打開或關閉。
86 |
87 | Android 系統只有:
88 |
89 | * **hidden**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。
90 | * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗
91 | * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗
92 | * **zoom**: 設置為`yes`,顯示 Android 瀏覽器的縮放控制項,設置為`no`,以隱藏它們。 `預設值是`.
93 | * **hardwareback**: 設置為`yes`要使用硬體後退按鈕通過`InAppBrowser`的歷史向後導航。 如果沒有前一頁, `InAppBrowser`將會關閉。 預設值是的`yes`所以你必須將其設置為`no`,如果你想要的後退按鈕,只需關閉 InAppBrowser。
94 |
95 | 只有 iOS:
96 |
97 | * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。請注意您需要對此值進行當地語系化你自己。
98 | * **disallowoverscroll**: 將設置為 `yes` 或 `no` (預設值是 `no` )。打開/關閉的 UIWebViewBounce 屬性。
99 | * **hidden**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。
100 | * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗
101 | * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗
102 | * **toolbar**: 設置為 `yes` 或 `no` ,為 InAppBrowser (預設為打開或關閉工具列`yes`)
103 | * **enableViewportScale**: 將設置為 `yes` 或 `no` ,防止通過 meta 標記 (預設為縮放的視區`no`).
104 | * **mediaPlaybackRequiresUserAction**: 將設置為 `yes` 或 `no` ,防止 HTML5 音訊或視頻從 autoplaying (預設為`no`).
105 | * **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`)
106 | * **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`).
107 | * **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`).
108 | * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle)(預設為`fullscreen`).
109 | * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle)(預設為`coververtical`).
110 | * **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。
111 |
112 | 僅限 Windows:
113 |
114 | * **hidden**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。
115 | * **fullscreen**: 設置為`yes`,以創建無邊框的瀏覽器控制項。 請注意,如果**location=no**同時指定,則將呈現給使用者到密切 IAB 視窗沒有控制。
116 |
117 | ### 支援的平臺
118 |
119 | * 亞馬遜火 OS
120 | * Android 系統
121 | * 黑莓 10
122 | * 火狐瀏覽器作業系統
123 | * iOS
124 | * Windows 8 和 8.1
125 | * Windows Phone 7 和 8
126 | * 瀏覽器
127 |
128 | ### 示例
129 |
130 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
131 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
132 |
133 |
134 | ### 火狐瀏覽器作業系統的怪癖
135 |
136 | 外掛程式不會強制任何設計是需要添加一些 CSS 規則,如果打開與 `target=_blank`。規則 》 可能看起來像這些
137 |
138 | ```css
139 | .inAppBrowserWrap {
140 | background-color: rgba(0,0,0,0.75);
141 | color: rgba(235,235,235,1.0);
142 | }
143 | .inAppBrowserWrap menu {
144 | overflow: auto;
145 | list-style-type: none;
146 | padding-left: 0;
147 | }
148 | .inAppBrowserWrap menu li {
149 | font-size: 25px;
150 | height: 25px;
151 | float: left;
152 | margin: 0 10px;
153 | padding: 3px 10px;
154 | text-decoration: none;
155 | color: #ccc;
156 | display: block;
157 | background: rgba(30,30,30,0.50);
158 | }
159 | .inAppBrowserWrap menu li.disabled {
160 | color: #777;
161 | }
162 | ```
163 |
164 | ### Windows 的怪癖
165 |
166 | 類似于 Firefox OS IAB 視窗視覺行為可以重寫通過`inAppBrowserWrap`/`inAppBrowserWrapFullscreen`的 CSS 類
167 |
168 | ### 瀏覽器的怪癖
169 |
170 | * 外掛程式是通過 iframe,執行
171 |
172 | * 未實現導航歷史記錄 (在 LocationBar 的`回顧`與`展望`按鈕)。
173 |
174 | ## InAppBrowser
175 |
176 | 對 `科爾多瓦的調用返回的物件。InAppBrowser.open`.
177 |
178 | ### 方法
179 |
180 | * addEventListener
181 | * removeEventListener
182 | * close
183 | * show
184 | * executeScript
185 | * insertCSS
186 |
187 | ## addEventListener
188 |
189 | > 為事件添加一個攔截器`InAppBrowser`.
190 |
191 | ref.addEventListener(eventname, callback);
192 |
193 |
194 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
195 |
196 | * **eventname**: 事件偵聽*(字串)*
197 |
198 | * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。
199 | * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。
200 | * **loaderror**: 當觸發事件 `InAppBrowser` 載入 URL 時遇到錯誤。
201 | * **exit**: 當觸發事件 `InAppBrowser` 關閉視窗。
202 |
203 | * **callback**: 執行時觸發該事件的函數。該函數通過 `InAppBrowserEvent` 物件作為參數。
204 |
205 | ### InAppBrowserEvent 屬性
206 |
207 | * **type**: eventname,或者 `loadstart` , `loadstop` , `loaderror` ,或 `exit` 。*(字串)*
208 |
209 | * **url**: 已載入的 URL。*(字串)*
210 |
211 | * **code**: 僅中的情況的錯誤代碼 `loaderror` 。*(人數)*
212 |
213 | * **message**: 該錯誤訊息,只有在的情況下 `loaderror` 。*(字串)*
214 |
215 | ### 支援的平臺
216 |
217 | * 亞馬遜火 OS
218 | * Android 系統
219 | * iOS
220 | * Windows 8 和 8.1
221 | * Windows Phone 7 和 8
222 | * 瀏覽器
223 |
224 | ### 瀏覽器的怪癖
225 |
226 | `loadstart`和`loaderror`的事件不會被觸發。
227 |
228 | ### 快速的示例
229 |
230 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
231 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
232 |
233 |
234 | ## removeEventListener
235 |
236 | > 移除的事件攔截器`InAppBrowser`.
237 |
238 | ref.removeEventListener(eventname, callback);
239 |
240 |
241 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
242 |
243 | * **eventname**: 要停止偵聽的事件。*(字串)*
244 |
245 | * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。
246 | * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。
247 | * **loaderror**: 當觸發事件 `InAppBrowser` 遇到錯誤載入一個 URL。
248 | * **exit**: 當觸發事件 `InAppBrowser` 關閉視窗。
249 |
250 | * **callback**: 要在事件觸發時執行的函數。該函數通過 `InAppBrowserEvent` 物件。
251 |
252 | ### 支援的平臺
253 |
254 | * 亞馬遜火 OS
255 | * Android 系統
256 | * iOS
257 | * Windows 8 和 8.1
258 | * Windows Phone 7 和 8
259 | * 瀏覽器
260 |
261 | ### 快速的示例
262 |
263 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
264 | var myCallback = function(event) { alert(event.url); }
265 | ref.addEventListener('loadstart', myCallback);
266 | ref.removeEventListener('loadstart', myCallback);
267 |
268 |
269 | ## close
270 |
271 | > 關閉 `InAppBrowser` 視窗。
272 |
273 | ref.close();
274 |
275 |
276 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
277 |
278 | ### 支援的平臺
279 |
280 | * 亞馬遜火 OS
281 | * Android 系統
282 | * 火狐瀏覽器作業系統
283 | * iOS
284 | * Windows 8 和 8.1
285 | * Windows Phone 7 和 8
286 | * 瀏覽器
287 |
288 | ### 快速的示例
289 |
290 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
291 | ref.close();
292 |
293 |
294 | ## show
295 |
296 | > 顯示打開了隱藏的 InAppBrowser 視窗。調用這沒有任何影響,如果 InAppBrowser 是已經可見。
297 |
298 | ref.show();
299 |
300 |
301 | * **ref**: InAppBrowser 視窗 (參考`InAppBrowser`)
302 |
303 | ### 支援的平臺
304 |
305 | * 亞馬遜火 OS
306 | * Android 系統
307 | * iOS
308 | * Windows 8 和 8.1
309 | * 瀏覽器
310 |
311 | ### 快速的示例
312 |
313 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
314 | // some time later...
315 | ref.show();
316 |
317 |
318 | ## executeScript
319 |
320 | > 注入到 JavaScript 代碼 `InAppBrowser` 視窗
321 |
322 | ref.executeScript(details, callback);
323 |
324 |
325 | * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser*
326 |
327 | * **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)*
328 |
329 | * **檔**: 腳本的 URL 來注入。
330 | * **代碼**: 要注入腳本的文本。
331 |
332 | * **回檔**: 執行後注入的 JavaScript 代碼的函數。
333 |
334 | * 如果插入的腳本的類型 `code` ,回檔執行使用單個參數,這是該腳本的傳回值,裹在 `Array` 。 對於多行腳本,這是最後一條語句或最後計算的運算式的傳回值。
335 |
336 | ### 支援的平臺
337 |
338 | * 亞馬遜火 OS
339 | * Android 系統
340 | * iOS
341 | * Windows 8 和 8.1
342 | * 瀏覽器
343 |
344 | ### 快速的示例
345 |
346 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
347 | ref.addEventListener('loadstop', function() {
348 | ref.executeScript({file: "myscript.js"});
349 | });
350 |
351 |
352 | ### 瀏覽器的怪癖
353 |
354 | * 只有**code**關鍵被支援。
355 |
356 | ### Windows 的怪癖
357 |
358 | 由於[MSDN 文檔](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx)調用的腳本可以返回唯一字串值,否則該參數,傳遞給**回檔**將是`[null]`.
359 |
360 | ## insertCSS
361 |
362 | > 注入到 CSS `InAppBrowser` 視窗。
363 |
364 | ref.insertCSS(details, callback);
365 |
366 |
367 | * **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)*
368 |
369 | * **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)*
370 |
371 | * **file**: 樣式表的 URL 來注入。
372 | * **code**: 文本樣式表的注入。
373 |
374 | * **callback**: 在 CSS 注射後執行的函數。
375 |
376 | ### 支援的平臺
377 |
378 | * 亞馬遜火 OS
379 | * Android 系統
380 | * iOS
381 | * Windows
382 |
383 | ### 快速的示例
384 |
385 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
386 | ref.addEventListener('loadstop', function() {
387 | ref.insertCSS({file: "mystyles.css"});
388 | });
--------------------------------------------------------------------------------
/doc/ja/index.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | このプラグインは `コルドバを呼び出すときに表示される web ブラウザーのビューを提供します。InAppBrowser.open()`.
23 |
24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
25 |
26 |
27 | `コルドバ。InAppBrowser.open()` `window.open()` 関数との交換を定義する関数。 既存の `window.open()` 呼び出しは、window.open を置き換えることによって InAppBrowser ウィンドウを使用できます。
28 |
29 | window.open = cordova.InAppBrowser.open;
30 |
31 |
32 | InAppBrowser ウィンドウは標準的な web ブラウザーのように動作し、コルドバ Api にアクセスできません。 この理由から、InAppBrowser お勧めする場合はメインのコルドバの webview を読み込むのではなくサード パーティ (信頼されていない) コンテンツをロードする必要があります。 InAppBrowser、ホワイト リストの対象ではないも、システムのブラウザーでリンクを開くです。
33 |
34 | InAppBrowser を提供しますデフォルトで GUI コントロール (戻る、進む、行う)。
35 |
36 | 後方互換性、このプラグインは、また `window.open` をフックのため。 ただし、`window.open` のプラグイン インストール フックを持つことができます意図しない副作用 (特に場合は、このプラグインは別のプラグインの依存関係としてのみ含まれています)。 `window.open` のフックは、将来のメジャー リリースで削除されます。 プラグインから、フックが削除されるまでアプリはデフォルトの動作を手動で復元できます。
37 |
38 | delete window.open // Reverts the call back to it's prototype's default
39 |
40 |
41 | `window.open` はグローバル スコープでは、InAppBrowser は、`deviceready` イベントの後まで利用できません。
42 |
43 | document.addEventListener("deviceready", onDeviceReady, false);
44 | function onDeviceReady() {
45 | console.log("window.open works well");
46 | }
47 |
48 |
49 | ## インストール
50 |
51 | cordova plugin add cordova-plugin-inappbrowser
52 |
53 |
54 | InAppBrowser を通過するアプリですべてのページの読み込みをする場合は初期化中に `window.open` を単にフックできます。たとえば。
55 |
56 | document.addEventListener("deviceready", onDeviceReady, false);
57 | function onDeviceReady() {
58 | window.open = cordova.InAppBrowser.open;
59 | }
60 |
61 |
62 | ## cordova.InAppBrowser.open
63 |
64 | 新しい `InAppBrowser` インスタンスを現在のブラウザー インスタンスまたはシステムのブラウザーで URL を開きます。
65 |
66 | var ref = cordova.InAppBrowser.open(url, target, options);
67 |
68 |
69 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
70 |
71 | * **url**: *(文字列)*をロードする URL。電話 `encodeURI()` 場合は、この上の URL は Unicode 文字を含みます。
72 |
73 | * **ターゲット**: ターゲット URL は、既定値は、省略可能なパラメーターをロードするを `_self` 。*(文字列)*
74 |
75 | * `_self`: コルドバ WebView URL がホワイト リストにある場合で開きます、それ以外の場合で開きます、`InAppBrowser`.
76 | * `_blank`: で開きます、`InAppBrowser`.
77 | * `_system`: システムの web ブラウザーで開きます。
78 |
79 | * **オプション**: おぷしょん、 `InAppBrowser` 。省略可能にする: `location=yes` 。*(文字列)*
80 |
81 | `options`文字列にはする必要があります任意の空白スペースが含まれていないと、各機能の名前と値のペアをコンマで区切る必要があります。 機能名では大文字小文字を区別します。 以下の値をサポートするプラットフォーム。
82 |
83 | * **場所**: に設定 `yes` または `no` を有効にする、 `InAppBrowser` の場所バー オンまたはオフにします。
84 |
85 | アンドロイドのみ:
86 |
87 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
88 | * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に
89 | * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に
90 |
91 | iOS のみ:
92 |
93 | * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。自分でこの値をローカライズする必要があることに注意してください。
94 | * **disallowoverscroll**: に設定されている `yes` または `no` (既定値は `no` )。/UIWebViewBounce プロパティをオフにします。
95 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
96 | * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に
97 | * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に
98 | * **ツールバー**: に設定されている `yes` または `no` InAppBrowser (デフォルトのツールバーのオンまたはオフを有効にするには`yes`)
99 | * **enableViewportScale**: に設定されている `yes` または `no` を (デフォルトではメタタグを介してスケーリング ビューポートを防ぐために`no`).
100 | * **mediaPlaybackRequiresUserAction**: に設定されている `yes` または `no` を HTML5 オーディオまたはビデオを自動再生 (初期設定から防ぐために`no`).
101 | * **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`)
102 | * **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`).
103 | * **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`).
104 | * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][1]を設定するには`fullscreen`).
105 | * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][2]を設定するには`coververtical`).
106 | * **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。
107 |
108 | Windows のみ:
109 |
110 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
111 |
112 | [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
113 | [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
114 |
115 | ### サポートされているプラットフォーム
116 |
117 | * アマゾン火 OS
118 | * アンドロイド
119 | * ブラックベリー 10
120 | * Firefox の OS
121 | * iOS
122 | * Windows 8 および 8.1
123 | * Windows Phone 7 と 8
124 |
125 | ### 例
126 |
127 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
128 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
129 |
130 |
131 | ### Firefox OS 癖
132 |
133 | 開かれた場合にいくつかの CSS ルールを追加する必要があるプラグインは任意のデザインを適用しないと `target ='_blank'`。これらのような規則になります。
134 |
135 | css
136 | .inAppBrowserWrap {
137 | background-color: rgba(0,0,0,0.75);
138 | color: rgba(235,235,235,1.0);
139 | }
140 | .inAppBrowserWrap menu {
141 | overflow: auto;
142 | list-style-type: none;
143 | padding-left: 0;
144 | }
145 | .inAppBrowserWrap menu li {
146 | font-size: 25px;
147 | height: 25px;
148 | float: left;
149 | margin: 0 10px;
150 | padding: 3px 10px;
151 | text-decoration: none;
152 | color: #ccc;
153 | display: block;
154 | background: rgba(30,30,30,0.50);
155 | }
156 | .inAppBrowserWrap menu li.disabled {
157 | color: #777;
158 | }
159 |
160 |
161 | ## InAppBrowser
162 |
163 | `コルドバへの呼び出しから返されるオブジェクト。InAppBrowser.open`.
164 |
165 | ### メソッド
166 |
167 | * addEventListener
168 | * removeEventListener
169 | * close
170 | * show
171 | * executeScript
172 | * insertCSS
173 |
174 | ## addEventListener
175 |
176 | > イベントのリスナーを追加します、`InAppBrowser`.
177 |
178 | ref.addEventListener(eventname, callback);
179 |
180 |
181 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
182 |
183 | * **eventname**: *(文字列)*をリッスンするイベント
184 |
185 | * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。
186 | * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。
187 | * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みでエラーが発生します。
188 | * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。
189 |
190 | * **コールバック**: イベントが発生したときに実行される関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクトをパラメーターとして。
191 |
192 | ### InAppBrowserEvent プロパティ
193 |
194 | * **タイプ**: eventname どちらか `loadstart` 、 `loadstop` 、 `loaderror` 、または `exit` 。*(文字列)*
195 |
196 | * **url**: URL が読み込まれました。*(文字列)*
197 |
198 | * **コード**: の場合にのみ、エラー コード `loaderror` 。*(数)*
199 |
200 | * **メッセージ**: の場合にのみ、エラー メッセージ `loaderror` 。*(文字列)*
201 |
202 | ### サポートされているプラットフォーム
203 |
204 | * アマゾン火 OS
205 | * アンドロイド
206 | * iOS
207 | * Windows 8 および 8.1
208 | * Windows Phone 7 と 8
209 |
210 | ### 簡単な例
211 |
212 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
213 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
214 |
215 |
216 | ## removeEventListener
217 |
218 | > イベントのリスナーを削除します、`InAppBrowser`.
219 |
220 | ref.removeEventListener(eventname, callback);
221 |
222 |
223 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
224 |
225 | * **eventname**: イベントのリッスンを停止します。*(文字列)*
226 |
227 | * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。
228 | * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。
229 | * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みエラーが発生します。
230 | * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。
231 |
232 | * **コールバック**: イベントが発生するときに実行する関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクト。
233 |
234 | ### サポートされているプラットフォーム
235 |
236 | * アマゾン火 OS
237 | * アンドロイド
238 | * iOS
239 | * Windows 8 および 8.1
240 | * Windows Phone 7 と 8
241 |
242 | ### 簡単な例
243 |
244 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
245 | var myCallback = function(event) { alert(event.url); }
246 | ref.addEventListener('loadstart', myCallback);
247 | ref.removeEventListener('loadstart', myCallback);
248 |
249 |
250 | ## close
251 |
252 | > 閉じる、 `InAppBrowser` ウィンドウ。
253 |
254 | ref.close();
255 |
256 |
257 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
258 |
259 | ### サポートされているプラットフォーム
260 |
261 | * アマゾン火 OS
262 | * アンドロイド
263 | * Firefox の OS
264 | * iOS
265 | * Windows 8 および 8.1
266 | * Windows Phone 7 と 8
267 |
268 | ### 簡単な例
269 |
270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
271 | ref.close();
272 |
273 |
274 | ## show
275 |
276 | > 隠された開かれた InAppBrowser ウィンドウが表示されます。この関数を呼び出すは影響しません、InAppBrowser が既に表示されている場合。
277 |
278 | ref.show();
279 |
280 |
281 | * **ref**: InAppBrowser ウィンドウ (への参照`InAppBrowser`)
282 |
283 | ### サポートされているプラットフォーム
284 |
285 | * アマゾン火 OS
286 | * アンドロイド
287 | * iOS
288 | * Windows 8 および 8.1
289 |
290 | ### 簡単な例
291 |
292 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
293 | // some time later...
294 | ref.show();
295 |
296 |
297 | ## executeScript
298 |
299 | > JavaScript コードに挿入します、 `InAppBrowser` ウィンドウ
300 |
301 | ref.executeScript(details, callback);
302 |
303 |
304 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
305 |
306 | * **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)*
307 |
308 | * **ファイル**: スクリプトの URL を注入します。
309 | * **コード**: スクリプトのテキストを挿入します。
310 |
311 | * **コールバック**: JavaScript コードを注入した後に実行される関数。
312 |
313 | * 挿入されたスクリプトが型の場合 `code` 、スクリプトの戻り値は、1 つのパラメーターでコールバックを実行するのに包まれて、 `Array` 。 マルチライン スクリプトについては、最後のステートメントでは、または評価した最後の式の戻り値です。
314 |
315 | ### サポートされているプラットフォーム
316 |
317 | * アマゾン火 OS
318 | * アンドロイド
319 | * iOS
320 | * Windows 8 および 8.1
321 |
322 | ### 簡単な例
323 |
324 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
325 | ref.addEventListener('loadstop', function() {
326 | ref.executeScript({file: "myscript.js"});
327 | });
328 |
329 |
330 | ## insertCSS
331 |
332 | > CSS に注入する、 `InAppBrowser` ウィンドウ。
333 |
334 | ref.insertCSS(details, callback);
335 |
336 |
337 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
338 |
339 | * **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)*
340 |
341 | * **ファイル**: 注入するスタイル シートの URL。
342 | * **コード**: 注入するスタイル シートのテキスト。
343 |
344 | * **コールバック**: CSS の注入後に実行される関数。
345 |
346 | ### サポートされているプラットフォーム
347 |
348 | * アマゾン火 OS
349 | * アンドロイド
350 | * iOS
351 |
352 | ### 簡単な例
353 |
354 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
355 | ref.addEventListener('loadstop', function() {
356 | ref.insertCSS({file: "mystyles.css"});
357 | });
358 |
--------------------------------------------------------------------------------
/doc/ko/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | [](https://travis-ci.org/apache/cordova-plugin-inappbrowser)
23 |
24 | 이 플러그인 `코르도바를 호출할 때 표시 하는 웹 브라우저 보기를 제공 합니다.InAppBrowser.open()`.
25 |
26 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
27 |
28 |
29 | `코르도바입니다.InAppBrowser.open()` 함수 `window.open ()` 함수에 대 한 대체품 정의 됩니다. 기존의 `window.open ()` 호출 window.open을 대체 하 여 InAppBrowser 윈도우를 사용할 수 있습니다.
30 |
31 | window.open = cordova.InAppBrowser.open;
32 |
33 |
34 | InAppBrowser 창 표준 웹 브라우저 처럼 동작 및 코르도바 Api에 액세스할 수 없습니다. 이 이유는 InAppBrowser는 것이 좋습니다는 주요 코르도바 webview로 로드 하는 대신 제 3 자 (신뢰할 수 없는) 콘텐츠를 로드 해야 할 경우. InAppBrowser는 허용 될 수도 시스템 브라우저에서 링크를 여는.
35 |
36 | 사용자에 대 한 자체 GUI 컨트롤에서 기본적으로 제공 된 InAppBrowser (뒤로, 앞으로, 완료).
37 |
38 | 대 한 뒤 호환성,이 플러그인도 `window.open` 후크. 그러나, `window.open`의 플러그인 설치 후크를 가질 수 있습니다 의도 하지 않은 부작용 (특히 경우이 플러그인이 다른 플러그인 종속성 으로만 포함). `window.open` 후크 주요 릴리스에서 제거 됩니다. 후크 플러그인에서 제거 될 때까지 애플 리 케이 션 수 있습니다 수동으로 기본 동작을 복원 하 게 됩니다.
39 |
40 | delete window.open // Reverts the call back to it's prototype's default
41 |
42 |
43 | `window.open` 전역 범위에 있지만 InAppBrowser 제공 되지 않습니다 때까지 `deviceready` 이벤트 후.
44 |
45 | document.addEventListener("deviceready", onDeviceReady, false);
46 | function onDeviceReady() {
47 | console.log("window.open works well");
48 | }
49 |
50 |
51 | ## 설치
52 |
53 | cordova plugin add cordova-plugin-inappbrowser
54 |
55 |
56 | InAppBrowser를 통해가 서 당신의 애플 리 케이 션에서 모든 페이지를 로드 하려는 경우 초기화 하는 동안 `window.open` 간단 하 게 연결할 수 있습니다. 예를 들어:
57 |
58 | document.addEventListener("deviceready", onDeviceReady, false);
59 | function onDeviceReady() {
60 | window.open = cordova.InAppBrowser.open;
61 | }
62 |
63 |
64 | ## cordova.InAppBrowser.open
65 |
66 | 새 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저에서 URL을 엽니다.
67 |
68 | var ref = cordova.InAppBrowser.open(url, target, options);
69 |
70 |
71 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
72 |
73 | * **url**: *(문자열)를*로드 하는 URL. 전화 `encodeURI()` 이 경우에는 URL 유니코드 문자를 포함 합니다.
74 |
75 | * **대상**: 대상 URL, 기본적으로 선택적 매개 변수를 로드 하는 `_self` . *(문자열)*
76 |
77 | * `_self`: URL 화이트 리스트에 있으면 코르도바 WebView에서 열리고, 그렇지 않으면 열에`InAppBrowser`.
78 | * `_blank`: 준공에`InAppBrowser`.
79 | * `_system`: 시스템의 웹 브라우저에서 엽니다.
80 |
81 | * **옵션**: 옵션은 `InAppBrowser` . 선택적, 디폴트에: `location=yes` . *(문자열)*
82 |
83 | `options`문자열 텅 빈 어떤 스페이스 포함 해서는 안 그리고 쉼표 각 기능의 이름/값 쌍을 구분 합니다. 기능 이름은 대/소문자입니다. 모든 플랫폼 지원 아래 값:
84 |
85 | * **위치**: 설정 `yes` 또는 `no` 설정 하는 `InAppBrowser` 의 위치 표시줄 켜거나 끕니다.
86 |
87 | 안 드 로이드만:
88 |
89 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
90 | * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다
91 | * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다
92 | * **zoom/축소**: `네` 안 드 로이드 브라우저의 확대/축소 컨트롤을 표시, 그들을 숨길 수 `없는` 로 설정으로 설정. 기본값은 `네`.
93 | * **hardwareback**: 하드웨어 뒤로 버튼을 사용 하 여 `InAppBrowser`의 역사를 통해 뒤로 이동 하려면 `예` 로 설정. 이전 페이지 없음이 있는 경우에, `InAppBrowser` 닫힙니다. 기본 값 이므로 `yes`, 뒤로 버튼을 간단 하 게는 InAppBrowser를 하려면 `no` 로 설정 해야 합니다.
94 |
95 | iOS만:
96 |
97 | * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. 참고 직접이 값을 지역화 해야 합니다.
98 | * **disallowoverscroll**: 설정 `yes` 또는 `no` (기본값은 `no` ). 회전 온/오프 UIWebViewBounce 속성입니다.
99 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
100 | * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다
101 | * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다
102 | * **도구 모음**: 설정 `yes` 또는 `no` InAppBrowser (기본값:에 대 한 도구 모음 온 / 오프를 돌기 위하여`yes`)
103 | * **enableViewportScale**: 설정 `yes` 또는 `no` 뷰포트 메타 태그 (기본값:를 통해 확장을 방지 하기 위해`no`).
104 | * **mediaPlaybackRequiresUserAction**: 설정 `yes` 또는 `no` HTML5 오디오 또는 비디오 자동 재생 (기본값에서에서 방지 하기 위해`no`).
105 | * **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`)
106 | * **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`).
107 | * **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`).
108 | * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle) (기본값을 설정 하려면`fullscreen`).
109 | * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (기본값을 설정 하려면`coververtical`).
110 | * **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다.
111 |
112 | Windows에만 해당:
113 |
114 | * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다.
115 | * **fullscreen**: 주위 테두리 없이 브라우저 컨트롤을 만드는 `yes` 를 설정. 참고로 만약 **location=no** 지정, 통제 내 사 창 닫기를 사용자에 게 표시 될 것입니다.
116 |
117 | ### 지원 되는 플랫폼
118 |
119 | * 아마존 화재 운영 체제
120 | * 안 드 로이드
121 | * 블랙베리 10
122 | * Firefox 운영 체제
123 | * iOS
124 | * 윈도우 8과 8.1
125 | * Windows Phone 7과 8
126 | * 브라우저
127 |
128 | ### 예를 들어
129 |
130 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
131 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
132 |
133 |
134 | ### 파이어 폭스 OS 단점
135 |
136 | 플러그인 어떤 디자인을 적용 하지 않는 경우 열 일부 CSS의 규칙을 추가할 필요가 있다 `target='_blank'`. 이 같이 규칙
137 |
138 | ```css
139 | .inAppBrowserWrap {
140 | background-color: rgba(0,0,0,0.75);
141 | color: rgba(235,235,235,1.0);
142 | }
143 | .inAppBrowserWrap menu {
144 | overflow: auto;
145 | list-style-type: none;
146 | padding-left: 0;
147 | }
148 | .inAppBrowserWrap menu li {
149 | font-size: 25px;
150 | height: 25px;
151 | float: left;
152 | margin: 0 10px;
153 | padding: 3px 10px;
154 | text-decoration: none;
155 | color: #ccc;
156 | display: block;
157 | background: rgba(30,30,30,0.50);
158 | }
159 | .inAppBrowserWrap menu li.disabled {
160 | color: #777;
161 | }
162 | ```
163 |
164 | ### 윈도우 특수
165 |
166 | 파이어 폭스 OS 내 사 창 시각적 행동 비슷한 `inAppBrowserWrap`통해 재정의할 수 /`inAppBrowserWrapFullscreen` CSS 클래스
167 |
168 | ### 브라우저 만지면
169 |
170 | * 플러그인은 iframe을 통해 구현
171 |
172 | * 탐색 기록 (LocationBar에서`뒤로` 및 `앞으로` 단추)은 구현 되지 않습니다.
173 |
174 | ## InAppBrowser
175 |
176 | `Cordova에 대 한 호출에서 반환 하는 개체.InAppBrowser.open`.
177 |
178 | ### 메서드
179 |
180 | * addEventListener
181 | * removeEventListener
182 | * close
183 | * show
184 | * executeScript
185 | * insertCSS
186 |
187 | ## addEventListener
188 |
189 | > 이벤트에 대 한 수신기를 추가 합니다`InAppBrowser`.
190 |
191 | ref.addEventListener(eventname, callback);
192 |
193 |
194 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
195 |
196 | * **eventname**: *(문자열)를* 수신 하도록 이벤트
197 |
198 | * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다.
199 | * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료.
200 | * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL을 로드할 때 오류가 발생 합니다.
201 | * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다.
202 |
203 | * **콜백**: 이벤트가 발생 될 때 실행 되는 함수. 함수는 전달 된 `InAppBrowserEvent` 개체를 매개 변수로 합니다.
204 |
205 | ### InAppBrowserEvent 속성
206 |
207 | * **유형**: eventname, 중 `loadstart` , `loadstop` , `loaderror` , 또는 `exit` . *(문자열)*
208 |
209 | * **url**: URL 로드 된. *(문자열)*
210 |
211 | * **코드**: 오류 코드의 경우에만 `loaderror` . *(수)*
212 |
213 | * **메시지**: 오류 메시지의 경우에만 `loaderror` . *(문자열)*
214 |
215 | ### 지원 되는 플랫폼
216 |
217 | * 아마존 화재 운영 체제
218 | * 안 드 로이드
219 | * iOS
220 | * 윈도우 8과 8.1
221 | * Windows Phone 7과 8
222 | * 브라우저
223 |
224 | ### 브라우저 만지면
225 |
226 | `loadstart` 및 `loaderror` 이벤트 해 고는 되 고.
227 |
228 | ### 빠른 예제
229 |
230 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
231 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
232 |
233 |
234 | ## removeEventListener
235 |
236 | > 이벤트에 대 한 수신기를 제거 합니다`InAppBrowser`.
237 |
238 | ref.removeEventListener(eventname, callback);
239 |
240 |
241 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
242 |
243 | * **eventname**: 이벤트 수신 대기를 중지 합니다. *(문자열)*
244 |
245 | * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다.
246 | * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료.
247 | * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL 로드 오류가 발생 합니다.
248 | * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다.
249 |
250 | * **콜백**: 이벤트가 발생 하면 실행할 함수. 함수는 전달 된 `InAppBrowserEvent` 개체.
251 |
252 | ### 지원 되는 플랫폼
253 |
254 | * 아마존 화재 운영 체제
255 | * 안 드 로이드
256 | * iOS
257 | * 윈도우 8과 8.1
258 | * Windows Phone 7과 8
259 | * 브라우저
260 |
261 | ### 빠른 예제
262 |
263 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
264 | var myCallback = function(event) { alert(event.url); }
265 | ref.addEventListener('loadstart', myCallback);
266 | ref.removeEventListener('loadstart', myCallback);
267 |
268 |
269 | ## close
270 |
271 | > 종료는 `InAppBrowser` 창.
272 |
273 | ref.close();
274 |
275 |
276 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
277 |
278 | ### 지원 되는 플랫폼
279 |
280 | * 아마존 화재 운영 체제
281 | * 안 드 로이드
282 | * Firefox 운영 체제
283 | * iOS
284 | * 윈도우 8과 8.1
285 | * Windows Phone 7과 8
286 | * 브라우저
287 |
288 | ### 빠른 예제
289 |
290 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
291 | ref.close();
292 |
293 |
294 | ## show
295 |
296 | > 숨겨진 열은 한 InAppBrowser 창을 표시 합니다. 전화는 InAppBrowser가 이미 보이는 경우는 효과가 없습니다.
297 |
298 | ref.show();
299 |
300 |
301 | * **ref**: InAppBrowser 창 (참조`InAppBrowser`)
302 |
303 | ### 지원 되는 플랫폼
304 |
305 | * 아마존 화재 운영 체제
306 | * 안 드 로이드
307 | * iOS
308 | * 윈도우 8과 8.1
309 | * 브라우저
310 |
311 | ### 빠른 예제
312 |
313 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
314 | // some time later...
315 | ref.show();
316 |
317 |
318 | ## executeScript
319 |
320 | > 에 자바 스크립트 코드를 삽입는 `InAppBrowser` 창
321 |
322 | ref.executeScript(details, callback);
323 |
324 |
325 | * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)*
326 |
327 | * **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)*
328 |
329 | * **파일**: 삽입 하는 스크립트의 URL.
330 | * **코드**: 스크립트 텍스트를 삽입 합니다.
331 |
332 | * **콜백**: 자바 스크립트 코드를 주입 후 실행 기능.
333 |
334 | * 삽입 된 스크립트 유형의 경우 `code` , 스크립트의 반환 값은 단일 매개 변수는 콜백 실행에 싸여 있는 `Array` . 여러 줄 스크립트에 대 한 마지막 문 또는 평가 마지막 식의 반환 값입니다.
335 |
336 | ### 지원 되는 플랫폼
337 |
338 | * 아마존 화재 운영 체제
339 | * 안 드 로이드
340 | * iOS
341 | * 윈도우 8과 8.1
342 | * 브라우저
343 |
344 | ### 빠른 예제
345 |
346 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
347 | ref.addEventListener('loadstop', function() {
348 | ref.executeScript({file: "myscript.js"});
349 | });
350 |
351 |
352 | ### 브라우저 만지면
353 |
354 | * **code** 키만 지원 됩니다.
355 |
356 | ### 윈도우 특수
357 |
358 | [MSDN 문서](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx) 인해 호출된 스크립트 반환할 수 있습니다 문자열 값만 그렇지 않으면 매개 변수, **콜백** 전달 `[null]` 될 것입니다..
359 |
360 | ## insertCSS
361 |
362 | > 주사로 CSS는 `InAppBrowser` 창.
363 |
364 | ref.insertCSS(details, callback);
365 |
366 |
367 | * **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)*
368 |
369 | * **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)*
370 |
371 | * **파일**: 삽입 하는 스타일 시트의 URL.
372 | * **코드**: 삽입 하는 스타일 시트의 텍스트.
373 |
374 | * **콜백**: CSS 주입 후 실행 기능.
375 |
376 | ### 지원 되는 플랫폼
377 |
378 | * 아마존 화재 운영 체제
379 | * 안 드 로이드
380 | * iOS
381 | * 윈도우
382 |
383 | ### 빠른 예제
384 |
385 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
386 | ref.addEventListener('loadstop', function() {
387 | ref.insertCSS({file: "mystyles.css"});
388 | });
--------------------------------------------------------------------------------
/doc/ru/index.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | Этот плагин обеспечивает представление веб-браузера, что показывает при вызове`window.open()`.
23 |
24 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
25 |
26 |
27 | **Примечание**: InAppBrowser окно ведет себя как стандартный веб-браузер и не может доступ API Cordova.
28 |
29 | ## Установка
30 |
31 | cordova plugin add cordova-plugin-inappbrowser
32 |
33 |
34 | ## window.open
35 |
36 | Открывает URL-адрес в новом `InAppBrowser` например, текущий экземпляр браузера или браузера системы.
37 |
38 | var ref = window.open(url, target, options);
39 |
40 |
41 | * **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)*
42 |
43 | * **URL**: URL-адрес для загрузки *(String)*. Вызвать `encodeURI()` на это, если URL-адрес содержит символы Unicode.
44 |
45 | * **Цель**: цель для загрузки URL-адреса, необязательный параметр, по умолчанию `_self` . *(Строка)*
46 |
47 | * `_self`: Открывается в Cordova WebView, если URL-адрес в белый список, в противном случае он открывается в`InAppBrowser`.
48 | * `_blank`: Открывает в`InAppBrowser`.
49 | * `_system`: Открывается в веб-браузера системы.
50 |
51 | * **опции**: параметры для `InAppBrowser` . Необязательный параметр, виновная в: `location=yes` . *(Строка)*
52 |
53 | `options`Строка не должна содержать каких-либо пустое пространство, и каждая функция пар имя/значение должны быть разделены запятой. Функция имена нечувствительны к регистру. Все платформы поддерживают исходное значение:
54 |
55 | * **Расположение**: равным `yes` или `no` превратить `InAppBrowser` в адресную строку или выключить.
56 |
57 | Только андроид:
58 |
59 | * **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** .
60 | * **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
61 | * **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна
62 | * **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна
63 |
64 | только iOS:
65 |
66 | * **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** . Обратите внимание, что вам нужно самостоятельно локализовать это значение.
67 | * **disallowoverscroll**: значение `yes` или `no` (по умолчанию `no` ). Включает/отключает свойство UIWebViewBounce.
68 | * **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
69 | * **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна
70 | * **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна
71 | * **панели инструментов**: набор `yes` или `no` для включения панели инструментов или выключить InAppBrowser (по умолчанию`yes`)
72 | * **enableViewportScale**: значение `yes` или `no` для предотвращения просмотра, масштабирования через тег meta (по умолчанию`no`).
73 | * **mediaPlaybackRequiresUserAction**: значение `yes` или `no` для предотвращения HTML5 аудио или видео от Автовоспроизведение (по умолчанию`no`).
74 | * **allowInlineMediaPlayback**: значение `yes` или `no` чтобы разрешить воспроизведение мультимедиа HTML5 в строки, отображения в окне браузера, а не конкретного устройства воспроизведения интерфейс. HTML `video` элемент должен также включать `webkit-playsinline` атрибут (по умолчанию`no`)
75 | * **keyboardDisplayRequiresUserAction**: значение `yes` или `no` чтобы открыть клавиатуру, когда формы элементы получают фокус через JavaScript в `focus()` вызов (по умолчанию`yes`).
76 | * **suppressesIncrementalRendering**: значение `yes` или `no` ждать, пока все новое содержание представление получено до визуализации (по умолчанию`no`).
77 | * **presentationstyle**: набор `pagesheet` , `formsheet` или `fullscreen` чтобы задать [стиль презентации][1] (по умолчанию`fullscreen`).
78 | * **transitionstyle**: набор `fliphorizontal` , `crossdissolve` или `coververtical` чтобы задать [стиль перехода][2] (по умолчанию`coververtical`).
79 | * **toolbarposition**: значение `top` или `bottom` (по умолчанию `bottom` ). Вызывает панели инструментов, чтобы быть в верхней или нижней части окна.
80 |
81 | Windows только:
82 |
83 | * **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально.
84 |
85 | [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
86 | [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
87 |
88 | ### Поддерживаемые платформы
89 |
90 | * Amazon Fire OS
91 | * Android
92 | * BlackBerry 10
93 | * Firefox OS
94 | * iOS
95 | * Windows 8 и 8.1
96 | * Windows Phone 7 и 8
97 |
98 | ### Пример
99 |
100 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
101 | var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
102 |
103 |
104 | ### Особенности Firefox OS
105 |
106 | Как плагин не применять любой дизайн есть необходимость добавить некоторые правила CSS, если открыт с `target='_blank'` . Правила может выглядеть как эти
107 |
108 | css
109 | .inAppBrowserWrap {
110 | background-color: rgba(0,0,0,0.75);
111 | color: rgba(235,235,235,1.0);
112 | }
113 | .inAppBrowserWrap menu {
114 | overflow: auto;
115 | list-style-type: none;
116 | padding-left: 0;
117 | }
118 | .inAppBrowserWrap menu li {
119 | font-size: 25px;
120 | height: 25px;
121 | float: left;
122 | margin: 0 10px;
123 | padding: 3px 10px;
124 | text-decoration: none;
125 | color: #ccc;
126 | display: block;
127 | background: rgba(30,30,30,0.50);
128 | }
129 | .inAppBrowserWrap menu li.disabled {
130 | color: #777;
131 | }
132 |
133 |
134 | ## Внутренний браузер
135 |
136 | Объект, возвращаемый из вызова`window.open`.
137 |
138 | ### Методы
139 |
140 | * addEventListener
141 | * removeEventListener
142 | * close
143 | * show
144 | * executeScript
145 | * insertCSS
146 |
147 | ## addEventListener
148 |
149 | > Добавляет прослушиватель для события от`InAppBrowser`.
150 |
151 | ref.addEventListener(eventname, callback);
152 |
153 |
154 | * **ссылка**: ссылка для `InAppBrowser` окно *(InAppBrowser)*
155 |
156 | * **EventName**: событие для прослушивания *(String)*
157 |
158 | * **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса.
159 | * **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса.
160 | * **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку при загрузке URL-адреса.
161 | * **выход**: возникает событие, когда `InAppBrowser` окно закрыто.
162 |
163 | * **обратного вызова**: функция, которая выполняется, когда возникает событие. Функция передается `InAppBrowserEvent` объект в качестве параметра.
164 |
165 | ### InAppBrowserEvent свойства
166 |
167 | * **тип**: eventname, либо `loadstart` , `loadstop` , `loaderror` , или `exit` . *(Строка)*
168 |
169 | * **URL**: URL-адрес, который был загружен. *(Строка)*
170 |
171 | * **код**: код ошибки, только в случае `loaderror` . *(Число)*
172 |
173 | * **сообщение**: сообщение об ошибке, только в случае `loaderror` . *(Строка)*
174 |
175 | ### Поддерживаемые платформы
176 |
177 | * Amazon Fire OS
178 | * Android
179 | * iOS
180 | * Windows 8 и 8.1
181 | * Windows Phone 7 и 8
182 |
183 | ### Краткий пример
184 |
185 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
186 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
187 |
188 |
189 | ## метод removeEventListener
190 |
191 | > Удаляет прослушиватель для события от`InAppBrowser`.
192 |
193 | ref.removeEventListener(eventname, callback);
194 |
195 |
196 | * **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)*
197 |
198 | * **EventName**: событие прекратить прослушивание. *(Строка)*
199 |
200 | * **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса.
201 | * **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса.
202 | * **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку загрузки URL-адреса.
203 | * **выход**: возникает событие, когда `InAppBrowser` окно закрывается.
204 |
205 | * **обратного вызова**: функция, выполняемая когда это событие наступает. Функция передается `InAppBrowserEvent` объект.
206 |
207 | ### Поддерживаемые платформы
208 |
209 | * Amazon Fire OS
210 | * Android
211 | * iOS
212 | * Windows 8 и 8.1
213 | * Windows Phone 7 и 8
214 |
215 | ### Краткий пример
216 |
217 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
218 | var myCallback = function(event) { alert(event.url); }
219 | ref.addEventListener('loadstart', myCallback);
220 | ref.removeEventListener('loadstart', myCallback);
221 |
222 |
223 | ## close
224 |
225 | > Закрывает `InAppBrowser` окно.
226 |
227 | Ref.Close();
228 |
229 |
230 | * **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)*
231 |
232 | ### Поддерживаемые платформы
233 |
234 | * Amazon Fire OS
235 | * Android
236 | * Firefox OS
237 | * iOS
238 | * Windows 8 и 8.1
239 | * Windows Phone 7 и 8
240 |
241 | ### Краткий пример
242 |
243 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
244 | ref.close();
245 |
246 |
247 | ## show
248 |
249 | > Отображается окно InAppBrowser, был открыт скрытые. Вызов это не имеет эффекта при InAppBrowser уже был виден.
250 |
251 | Ref.Show();
252 |
253 |
254 | * **ссылка**: ссылка на окно (InAppBrowser`InAppBrowser`)
255 |
256 | ### Поддерживаемые платформы
257 |
258 | * Amazon Fire OS
259 | * Android
260 | * iOS
261 | * Windows 8 и 8.1
262 |
263 | ### Краткий пример
264 |
265 | var ref = window.open('http://apache.org', '_blank', 'hidden=yes');
266 | // some time later...
267 | ref.show();
268 |
269 |
270 | ## executeScript
271 |
272 | > Вставляет код JavaScript в `InAppBrowser` окно
273 |
274 | ref.executeScript(details, callback);
275 |
276 |
277 | * **ссылка**: ссылка на `InAppBrowser` окно. *(InAppBrowser)*
278 |
279 | * **injectDetails**: подробности сценария для запуска, указав либо `file` или `code` ключ. *(Объект)*
280 |
281 | * **файл**: URL-адрес сценария вставки.
282 | * **код**: текст сценария для вставки.
283 |
284 | * **обратного вызова**: функция, которая выполняет после вводят JavaScript-код.
285 |
286 | * Если введенный скрипт имеет тип `code` , обратный вызов выполняется с одним параметром, который является возвращаемое значение сценария, завернутые в `Array` . Для многострочных сценариев это возвращаемое значение последнего оператора, или последнее вычисленное выражение.
287 |
288 | ### Поддерживаемые платформы
289 |
290 | * Amazon Fire OS
291 | * Android
292 | * iOS
293 | * Windows 8 и 8.1
294 |
295 | ### Краткий пример
296 |
297 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
298 | ref.addEventListener('loadstop', function() {
299 | ref.executeScript({file: "myscript.js"});
300 | });
301 |
302 |
303 | ## insertCSS
304 |
305 | > Внедряет CSS в `InAppBrowser` окно.
306 |
307 | ref.insertCSS(details, callback);
308 |
309 |
310 | * **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)*
311 |
312 | * **injectDetails**: детали сценария для запуска, указав либо `file` или `code` ключ. *(Объект)*
313 |
314 | * **файл**: URL-адрес таблицы стилей для вставки.
315 | * **код**: текст таблицы стилей для вставки.
316 |
317 | * **обратного вызова**: функция, которая выполняет после вводят CSS.
318 |
319 | ### Поддерживаемые платформы
320 |
321 | * Amazon Fire OS
322 | * Android
323 | * iOS
324 |
325 | ### Краткий пример
326 |
327 | var ref = window.open('http://apache.org', '_blank', 'location=yes');
328 | ref.addEventListener('loadstop', function() {
329 | ref.insertCSS({file: "mystyles.css"});
330 | });
331 |
--------------------------------------------------------------------------------
/doc/ja/README.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | [](https://travis-ci.org/apache/cordova-plugin-inappbrowser)
23 |
24 | このプラグインは `コルドバを呼び出すときに表示される web ブラウザーのビューを提供します。InAppBrowser.open()`.
25 |
26 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
27 |
28 |
29 | `コルドバ。InAppBrowser.open()` `window.open()` 関数との交換を定義する関数。 既存の `window.open()` 呼び出しは、window.open を置き換えることによって InAppBrowser ウィンドウを使用できます。
30 |
31 | window.open = cordova.InAppBrowser.open;
32 |
33 |
34 | InAppBrowser ウィンドウは標準的な web ブラウザーのように動作し、コルドバ Api にアクセスできません。 この理由から、InAppBrowser お勧めする場合はメインのコルドバの webview を読み込むのではなくサード パーティ (信頼されていない) コンテンツをロードする必要があります。 InAppBrowser、ホワイト リストの対象ではないも、システムのブラウザーでリンクを開くです。
35 |
36 | InAppBrowser を提供しますデフォルトで GUI コントロール (戻る、進む、行う)。
37 |
38 | 後方互換性、このプラグインは、また `window.open` をフックのため。 ただし、`window.open` のプラグイン インストール フックを持つことができます意図しない副作用 (特に場合は、このプラグインは別のプラグインの依存関係としてのみ含まれています)。 `window.open` のフックは、将来のメジャー リリースで削除されます。 プラグインから、フックが削除されるまでアプリはデフォルトの動作を手動で復元できます。
39 |
40 | delete window.open // Reverts the call back to it's prototype's default
41 |
42 |
43 | `window.open` はグローバル スコープでは、InAppBrowser は、`deviceready` イベントの後まで利用できません。
44 |
45 | document.addEventListener("deviceready", onDeviceReady, false);
46 | function onDeviceReady() {
47 | console.log("window.open works well");
48 | }
49 |
50 |
51 | ## インストール
52 |
53 | cordova plugin add cordova-plugin-inappbrowser
54 |
55 |
56 | InAppBrowser を通過するアプリですべてのページの読み込みをする場合は初期化中に `window.open` を単にフックできます。たとえば。
57 |
58 | document.addEventListener("deviceready", onDeviceReady, false);
59 | function onDeviceReady() {
60 | window.open = cordova.InAppBrowser.open;
61 | }
62 |
63 |
64 | ## cordova.InAppBrowser.open
65 |
66 | 新しい `InAppBrowser` インスタンスを現在のブラウザー インスタンスまたはシステムのブラウザーで URL を開きます。
67 |
68 | var ref = cordova.InAppBrowser.open(url, target, options);
69 |
70 |
71 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
72 |
73 | * **url**: *(文字列)*をロードする URL。電話 `encodeURI()` 場合は、この上の URL は Unicode 文字を含みます。
74 |
75 | * **ターゲット**: ターゲット URL は、既定値は、省略可能なパラメーターをロードするを `_self` 。*(文字列)*
76 |
77 | * `_self`: コルドバ WebView URL がホワイト リストにある場合で開きます、それ以外の場合で開きます、`InAppBrowser`.
78 | * `_blank`: で開きます、`InAppBrowser`.
79 | * `_system`: システムの web ブラウザーで開きます。
80 |
81 | * **オプション**: おぷしょん、 `InAppBrowser` 。省略可能にする: `location=yes` 。*(文字列)*
82 |
83 | `options`文字列にはする必要があります任意の空白スペースが含まれていないと、各機能の名前と値のペアをコンマで区切る必要があります。 機能名では大文字小文字を区別します。 以下の値をサポートするプラットフォーム。
84 |
85 | * **場所**: に設定 `yes` または `no` を有効にする、 `InAppBrowser` の場所バー オンまたはオフにします。
86 |
87 | アンドロイドのみ:
88 |
89 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
90 | * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に
91 | * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に
92 | * **zoom**:`yes`Android ブラウザーのズーム コントロールの表示を`no`に設定すると、それらを非表示に設定します。 既定値は`yes`.
93 | * **hardwareback**: `InAppBrowser`の履歴を後方に移動するのにハードウェアの戻るボタンを使用して`yes`に設定します。 前のページがない場合は、 `InAppBrowser`が終了します。 既定値は`はい`、ため場合は、単に、InAppBrowser を閉じる戻るボタン`なし`を設定する必要があります。
94 |
95 | iOS のみ:
96 |
97 | * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。自分でこの値をローカライズする必要があることに注意してください。
98 | * **disallowoverscroll**: に設定されている `yes` または `no` (既定値は `no` )。/UIWebViewBounce プロパティをオフにします。
99 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
100 | * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に
101 | * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に
102 | * **ツールバー**: に設定されている `yes` または `no` InAppBrowser (デフォルトのツールバーのオンまたはオフを有効にするには`yes`)
103 | * **enableViewportScale**: に設定されている `yes` または `no` を (デフォルトではメタタグを介してスケーリング ビューポートを防ぐために`no`).
104 | * **mediaPlaybackRequiresUserAction**: に設定されている `yes` または `no` を HTML5 オーディオまたはビデオを自動再生 (初期設定から防ぐために`no`).
105 | * **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`)
106 | * **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`).
107 | * **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`).
108 | * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle)を設定するには`fullscreen`).
109 | * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle)を設定するには`coververtical`).
110 | * **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。
111 |
112 | Windows のみ:
113 |
114 | * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。
115 | * **fullscreen**: 周りに境界線なしブラウザー コントロールを作成する`[yes]`に設定します。 その場合に注意してください**location=no**指定また、IAB ウィンドウを閉じるためにユーザーに提示はコントロールされます。
116 |
117 | ### サポートされているプラットフォーム
118 |
119 | * アマゾン火 OS
120 | * アンドロイド
121 | * ブラックベリー 10
122 | * Firefox の OS
123 | * iOS
124 | * Windows 8 および 8.1
125 | * Windows Phone 7 と 8
126 | * ブラウザー
127 |
128 | ### 例
129 |
130 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
131 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
132 |
133 |
134 | ### Firefox OS 癖
135 |
136 | 開かれた場合にいくつかの CSS ルールを追加する必要があるプラグインは任意のデザインを適用しないと `target ='_blank'`。これらのような規則になります。
137 |
138 | ```css
139 | .inAppBrowserWrap {
140 | background-color: rgba(0,0,0,0.75);
141 | color: rgba(235,235,235,1.0);
142 | }
143 | .inAppBrowserWrap menu {
144 | overflow: auto;
145 | list-style-type: none;
146 | padding-left: 0;
147 | }
148 | .inAppBrowserWrap menu li {
149 | font-size: 25px;
150 | height: 25px;
151 | float: left;
152 | margin: 0 10px;
153 | padding: 3px 10px;
154 | text-decoration: none;
155 | color: #ccc;
156 | display: block;
157 | background: rgba(30,30,30,0.50);
158 | }
159 | .inAppBrowserWrap menu li.disabled {
160 | color: #777;
161 | }
162 | ```
163 |
164 | ### Windows の癖
165 |
166 | `InAppBrowserWrap`経由で Firefox OS IAB ウィンドウの視覚的動作に似ていますをオーバーライドできます/`inAppBrowserWrapFullscreen` CSS クラス
167 |
168 | ### ブラウザーの癖
169 |
170 | * Iframe を介してプラグインを実装します。
171 |
172 | * ナビゲーション履歴 (LocationBar の`進む`と`戻る`ボタン) は実装されていません。
173 |
174 | ## InAppBrowser
175 |
176 | `コルドバへの呼び出しから返されるオブジェクト。InAppBrowser.open`.
177 |
178 | ### メソッド
179 |
180 | * addEventListener
181 | * removeEventListener
182 | * close
183 | * show
184 | * executeScript
185 | * insertCSS
186 |
187 | ## addEventListener
188 |
189 | > イベントのリスナーを追加します、`InAppBrowser`.
190 |
191 | ref.addEventListener(eventname, callback);
192 |
193 |
194 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
195 |
196 | * **eventname**: *(文字列)*をリッスンするイベント
197 |
198 | * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。
199 | * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。
200 | * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みでエラーが発生します。
201 | * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。
202 |
203 | * **コールバック**: イベントが発生したときに実行される関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクトをパラメーターとして。
204 |
205 | ### InAppBrowserEvent プロパティ
206 |
207 | * **タイプ**: eventname どちらか `loadstart` 、 `loadstop` 、 `loaderror` 、または `exit` 。*(文字列)*
208 |
209 | * **url**: URL が読み込まれました。*(文字列)*
210 |
211 | * **コード**: の場合にのみ、エラー コード `loaderror` 。*(数)*
212 |
213 | * **メッセージ**: の場合にのみ、エラー メッセージ `loaderror` 。*(文字列)*
214 |
215 | ### サポートされているプラットフォーム
216 |
217 | * アマゾン火 OS
218 | * アンドロイド
219 | * iOS
220 | * Windows 8 および 8.1
221 | * Windows Phone 7 と 8
222 | * ブラウザー
223 |
224 | ### ブラウザーの癖
225 |
226 | `loadstart` `loaderror`イベントが発生していません。
227 |
228 | ### 簡単な例
229 |
230 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
231 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
232 |
233 |
234 | ## removeEventListener
235 |
236 | > イベントのリスナーを削除します、`InAppBrowser`.
237 |
238 | ref.removeEventListener(eventname, callback);
239 |
240 |
241 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
242 |
243 | * **eventname**: イベントのリッスンを停止します。*(文字列)*
244 |
245 | * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。
246 | * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。
247 | * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みエラーが発生します。
248 | * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。
249 |
250 | * **コールバック**: イベントが発生するときに実行する関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクト。
251 |
252 | ### サポートされているプラットフォーム
253 |
254 | * アマゾン火 OS
255 | * アンドロイド
256 | * iOS
257 | * Windows 8 および 8.1
258 | * Windows Phone 7 と 8
259 | * ブラウザー
260 |
261 | ### 簡単な例
262 |
263 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
264 | var myCallback = function(event) { alert(event.url); }
265 | ref.addEventListener('loadstart', myCallback);
266 | ref.removeEventListener('loadstart', myCallback);
267 |
268 |
269 | ## close
270 |
271 | > 閉じる、 `InAppBrowser` ウィンドウ。
272 |
273 | ref.close();
274 |
275 |
276 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
277 |
278 | ### サポートされているプラットフォーム
279 |
280 | * アマゾン火 OS
281 | * アンドロイド
282 | * Firefox の OS
283 | * iOS
284 | * Windows 8 および 8.1
285 | * Windows Phone 7 と 8
286 | * ブラウザー
287 |
288 | ### 簡単な例
289 |
290 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
291 | ref.close();
292 |
293 |
294 | ## show
295 |
296 | > 隠された開かれた InAppBrowser ウィンドウが表示されます。この関数を呼び出すは影響しません、InAppBrowser が既に表示されている場合。
297 |
298 | ref.show();
299 |
300 |
301 | * **ref**: InAppBrowser ウィンドウ (への参照`InAppBrowser`)
302 |
303 | ### サポートされているプラットフォーム
304 |
305 | * アマゾン火 OS
306 | * アンドロイド
307 | * iOS
308 | * Windows 8 および 8.1
309 | * ブラウザー
310 |
311 | ### 簡単な例
312 |
313 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
314 | // some time later...
315 | ref.show();
316 |
317 |
318 | ## executeScript
319 |
320 | > JavaScript コードに挿入します、 `InAppBrowser` ウィンドウ
321 |
322 | ref.executeScript(details, callback);
323 |
324 |
325 | * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)*
326 |
327 | * **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)*
328 |
329 | * **ファイル**: スクリプトの URL を注入します。
330 | * **コード**: スクリプトのテキストを挿入します。
331 |
332 | * **コールバック**: JavaScript コードを注入した後に実行される関数。
333 |
334 | * 挿入されたスクリプトが型の場合 `code` 、スクリプトの戻り値は、1 つのパラメーターでコールバックを実行するのに包まれて、 `Array` 。 マルチライン スクリプトについては、最後のステートメントでは、または評価した最後の式の戻り値です。
335 |
336 | ### サポートされているプラットフォーム
337 |
338 | * アマゾン火 OS
339 | * アンドロイド
340 | * iOS
341 | * Windows 8 および 8.1
342 | * ブラウザー
343 |
344 | ### 簡単な例
345 |
346 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
347 | ref.addEventListener('loadstop', function() {
348 | ref.executeScript({file: "myscript.js"});
349 | });
350 |
351 |
352 | ### ブラウザーの癖
353 |
354 | * **code**キーのみをサポートします。
355 |
356 | ### Windows の癖
357 |
358 | [MSDN ドキュメント](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx)のため呼び出されたスクリプト パラメーターを返す文字列値のみそれ以外の場合は、**コールバック**に渡される`[null]`になります.
359 |
360 | ## insertCSS
361 |
362 | > CSS に注入する、 `InAppBrowser` ウィンドウ。
363 |
364 | ref.insertCSS(details, callback);
365 |
366 |
367 | * **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)*
368 |
369 | * **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)*
370 |
371 | * **ファイル**: 注入するスタイル シートの URL。
372 | * **コード**: 注入するスタイル シートのテキスト。
373 |
374 | * **コールバック**: CSS の注入後に実行される関数。
375 |
376 | ### サポートされているプラットフォーム
377 |
378 | * アマゾン火 OS
379 | * アンドロイド
380 | * iOS
381 | * Windows
382 |
383 | ### 簡単な例
384 |
385 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
386 | ref.addEventListener('loadstop', function() {
387 | ref.insertCSS({file: "mystyles.css"});
388 | });
--------------------------------------------------------------------------------
/doc/pl/index.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # cordova-plugin-inappbrowser
21 |
22 | Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `cordova.InAppBrowser.open()`.
23 |
24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
25 |
26 |
27 | `cordova.InAppBrowser.open()` funkcja jest definiowana jako zamiennik dla funkcji `window.open()`. Istniejące wywołania `window.open()` służy okno InAppBrowser, zastępując window.open:
28 |
29 | window.open = cordova.InAppBrowser.open;
30 |
31 |
32 | Okna InAppBrowser zachowuje się jak standardowe przeglądarki i nie ma dostępu do API Cordova. Z tego powodu zaleca się InAppBrowser jeśli ty potrzebować wobec ciężar (niezaufanej) treści osób trzecich, a nie że wczytywanie głównym webview Cordova. InAppBrowser nie jest biała, ani nie jest otwieranie linków w przeglądarce systemu.
33 |
34 | InAppBrowser zawiera domyślnie kontrole GUI dla użytkownika (tył, przód, zrobić).
35 |
36 | Do tyłu zgodności, ten plugin również haki `window.open`. Jednak może mieć zainstalowane wtyczki haka `window.open` niezamierzone skutki uboczne (zwłaszcza, jeśli ten plugin jest włączone tylko jako część innej wtyczki). Hak `window.open` zostaną usunięte w przyszłej wersji głównych. Dopóki hak jest usuwany z wtyczki, aplikacje można ręcznie przywrócić domyślne zachowanie:
37 |
38 | delete window.open // Reverts the call back to it's prototype's default
39 |
40 |
41 | Chociaż `window.open` w globalnym zasięgu, InAppBrowser nie jest dostępne dopiero po zdarzeniu `deviceready`.
42 |
43 | document.addEventListener("deviceready", onDeviceReady, false);
44 | function onDeviceReady() {
45 | console.log("window.open works well");
46 | }
47 |
48 |
49 | ## Instalacja
50 |
51 | cordova plugin add cordova-plugin-inappbrowser
52 |
53 |
54 | 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:
55 |
56 | document.addEventListener("deviceready", onDeviceReady, false);
57 | function onDeviceReady() {
58 | window.open = cordova.InAppBrowser.open;
59 | }
60 |
61 |
62 | ## cordova.InAppBrowser.open
63 |
64 | Otwiera URL w nowe wystąpienie `InAppBrowser`, bieżące wystąpienie przeglądarki lub przeglądarki systemu.
65 |
66 | var ref = cordova.InAppBrowser.open(url, target, options);
67 |
68 |
69 | * **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)*
70 |
71 | * **adres**: adres URL do ładowania *(ciąg)*. Wywołanie `encodeURI()` na to, czy adres URL zawiera znaki Unicode.
72 |
73 | * **miejsce docelowe**: miejsce docelowe, w którym wobec ciężar ten URL parametr opcjonalny, który domyślnie `_self` . *(String)*
74 |
75 | * `_self`: Otwiera w Cordova WebView, jeśli adres URL jest na białej liście, inaczej ono otwiera w`InAppBrowser`.
76 | * `_blank`: Otwiera w`InAppBrowser`.
77 | * `_system`: Otwiera w przeglądarce internetowej systemu.
78 |
79 | * **Opcje**: opcje dla `InAppBrowser` . Opcjonalnie, nie stawiła się: `location=yes` . *(String)*
80 |
81 | `options`Ciąg nie może zawierać żadnych spacji, i pary nazwa/wartość każdej funkcji muszą być oddzielone przecinkami. Nazwy funkcji jest rozróżniana. Wszystkich platform obsługuje wartości poniżej:
82 |
83 | * **Lokalizacja**: zestaw `yes` lub `no` Aby włączyć `InAppBrowser` na pasek lub wyłączyć.
84 |
85 | Android:
86 |
87 | * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie.
88 | * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno
89 | * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno
90 |
91 | tylko iOS:
92 |
93 | * **closebuttoncaption**: aby użyć jak **zrobić** przycisk Podpis ustawiona na ciąg. Należy pamiętać, że trzeba zlokalizować tę wartość siebie.
94 | * **disallowoverscroll**: zestaw `yes` lub `no` (domyślnie `no` ). Włącza/wyłącza właściwość UIWebViewBounce.
95 | * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie.
96 | * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno
97 | * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno
98 | * **pasek narzędzi**: zestaw `yes` lub `no` Aby włączyć pasek narzędzi lub wyłączyć dla InAppBrowser (domyślnie`yes`)
99 | * **enableViewportScale**: zestaw `yes` lub `no` Aby zapobiec rzutni skalowanie za pomocą tagu meta (domyślnie`no`).
100 | * **mediaPlaybackRequiresUserAction**: zestaw `yes` lub `no` Aby zapobiec HTML5 audio lub wideo z Autoodtwarzanie (domyślnie`no`).
101 | * **allowInlineMediaPlayback**: zestaw `yes` lub `no` Aby w linii HTML5 odtwarzanie, wyświetlanie w oknie przeglądarki, a nie interfejs odtwarzanie specyficzne dla urządzenia. HTML `video` również musi zawierać element `webkit-playsinline` atrybut (domyślnie`no`)
102 | * **keyboardDisplayRequiresUserAction**: zestaw `yes` lub `no` Aby otworzyć klawiaturę ekranową, gdy elementy formularza ostrości za pomocą JavaScript `focus()` połączenia (domyślnie`yes`).
103 | * **suppressesIncrementalRendering**: zestaw `yes` lub `no` czekać, aż wszystkie nowe widok zawartości jest otrzymane przed renderowany (domyślnie`no`).
104 | * **presentationstyle**: zestaw `pagesheet` , `formsheet` lub `fullscreen` Aby ustawić [styl prezentacji][1] (domyślnie`fullscreen`).
105 | * **transitionstyle**: zestaw `fliphorizontal` , `crossdissolve` lub `coververtical` Aby ustawić [styl przejścia][2] (domyślnie`coververtical`).
106 | * **toolbarposition**: zestaw `top` lub `bottom` (domyślnie `bottom` ). Powoduje, że pasek ma być na górze lub na dole okna.
107 |
108 | Windows tylko:
109 |
110 | * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie.
111 |
112 | [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
113 | [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
114 |
115 | ### Obsługiwane platformy
116 |
117 | * Amazon Fire OS
118 | * Android
119 | * BlackBerry 10
120 | * Firefox OS
121 | * iOS
122 | * Windows 8 i 8.1
123 | * Windows Phone 7 i 8
124 |
125 | ### Przykład
126 |
127 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
128 | var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
129 |
130 |
131 | ### Firefox OS dziwactwa
132 |
133 | Jak plugin nie wymuszać każdy projekt to trzeba dodać pewne reguły CSS jeśli otwarty z `target = "_blank"`. Zasady może wyglądać jak te
134 |
135 | css
136 | .inAppBrowserWrap {
137 | background-color: rgba(0,0,0,0.75);
138 | color: rgba(235,235,235,1.0);
139 | }
140 | .inAppBrowserWrap menu {
141 | overflow: auto;
142 | list-style-type: none;
143 | padding-left: 0;
144 | }
145 | .inAppBrowserWrap menu li {
146 | font-size: 25px;
147 | height: 25px;
148 | float: left;
149 | margin: 0 10px;
150 | padding: 3px 10px;
151 | text-decoration: none;
152 | color: #ccc;
153 | display: block;
154 | background: rgba(30,30,30,0.50);
155 | }
156 | .inAppBrowserWrap menu li.disabled {
157 | color: #777;
158 | }
159 |
160 |
161 | ## InAppBrowser
162 |
163 | Obiekt zwrócony z wywołania `cordova.InAppBrowser.open`.
164 |
165 | ### Metody
166 |
167 | * metody addEventListener
168 | * removeEventListener
169 | * Zamknij
170 | * Pokaż
171 | * executeScript
172 | * insertCSS
173 |
174 | ## metody addEventListener
175 |
176 | > Dodaje detektor zdarzenia z`InAppBrowser`.
177 |
178 | ref.addEventListener(eventname, callback);
179 |
180 |
181 | * **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)*
182 |
183 | * **EventName**: zdarzenie słuchać *(String)*
184 |
185 | * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL.
186 | * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL.
187 | * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd podczas ładowania adresu URL.
188 | * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte.
189 |
190 | * **wywołania zwrotnego**: funkcja, która wykonuje, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu jako parametr.
191 |
192 | ### Właściwości InAppBrowserEvent
193 |
194 | * **Typ**: eventname, albo `loadstart` , `loadstop` , `loaderror` , lub `exit` . *(String)*
195 |
196 | * **adres**: adres URL, który został załadowany. *(String)*
197 |
198 | * **Kod**: kod błędu, tylko w przypadku `loaderror` . *(Liczba)*
199 |
200 | * **wiadomość**: komunikat o błędzie, tylko w przypadku `loaderror` . *(String)*
201 |
202 | ### Obsługiwane platformy
203 |
204 | * Amazon Fire OS
205 | * Android
206 | * iOS
207 | * Windows 8 i 8.1
208 | * Windows Phone 7 i 8
209 |
210 | ### Szybki przykład
211 |
212 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
213 | ref.addEventListener('loadstart', function(event) { alert(event.url); });
214 |
215 |
216 | ## removeEventListener
217 |
218 | > Usuwa detektor zdarzenia z`InAppBrowser`.
219 |
220 | ref.removeEventListener(eventname, callback);
221 |
222 |
223 | * **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)*
224 |
225 | * **EventName**: zdarzenie przestanie słuchać. *(String)*
226 |
227 | * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL.
228 | * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL.
229 | * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd ładowania adresu URL.
230 | * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte.
231 |
232 | * **wywołania zwrotnego**: funkcja do wykonania, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu.
233 |
234 | ### Obsługiwane platformy
235 |
236 | * Amazon Fire OS
237 | * Android
238 | * iOS
239 | * Windows 8 i 8.1
240 | * Windows Phone 7 i 8
241 |
242 | ### Szybki przykład
243 |
244 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
245 | var myCallback = function(event) { alert(event.url); }
246 | ref.addEventListener('loadstart', myCallback);
247 | ref.removeEventListener('loadstart', myCallback);
248 |
249 |
250 | ## Zamknij
251 |
252 | > Zamyka `InAppBrowser` okna.
253 |
254 | ref.close();
255 |
256 |
257 | * **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)*
258 |
259 | ### Obsługiwane platformy
260 |
261 | * Amazon Fire OS
262 | * Android
263 | * Firefox OS
264 | * iOS
265 | * Windows 8 i 8.1
266 | * Windows Phone 7 i 8
267 |
268 | ### Szybki przykład
269 |
270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
271 | ref.close();
272 |
273 |
274 | ## Pokaż
275 |
276 | > Wyświetla InAppBrowser okno, który został otwarty ukryte. Zawód ten jest ignorowany, jeśli InAppBrowser już był widoczny.
277 |
278 | ref.show();
279 |
280 |
281 | * **ref**: odwołanie do InAppBrowser (okno`InAppBrowser`)
282 |
283 | ### Obsługiwane platformy
284 |
285 | * Amazon Fire OS
286 | * Android
287 | * iOS
288 | * Windows 8 i 8.1
289 |
290 | ### Szybki przykład
291 |
292 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
293 | // some time later...
294 | ref.show();
295 |
296 |
297 | ## executeScript
298 |
299 | > Wstrzykuje kod JavaScript w `InAppBrowser` okna
300 |
301 | ref.executeScript(details, callback);
302 |
303 |
304 | * **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)*
305 |
306 | * **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)*
307 |
308 | * **plik**: adres URL skryptu, aby wstrzyknąć.
309 | * **Kod**: tekst skryptu, aby wstrzyknąć.
310 |
311 | * **wywołania zwrotnego**: funkcja, która wykonuje po kod JavaScript jest wstrzykiwany.
312 |
313 | * Jeśli taki skrypt jest typu `code` , wykonuje wywołanie zwrotne z pojedynczym parametrem, który jest wartość zwracana przez skrypt, owinięte w `Array` . Dla wielu linii skrypty to wartość zwracana ostatniej instrukcja, lub ostatni wyrażenie oceniane.
314 |
315 | ### Obsługiwane platformy
316 |
317 | * Amazon Fire OS
318 | * Android
319 | * iOS
320 | * Windows 8 i 8.1
321 |
322 | ### Szybki przykład
323 |
324 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
325 | ref.addEventListener('loadstop', function() {
326 | ref.executeScript({file: "myscript.js"});
327 | });
328 |
329 |
330 | ## insertCSS
331 |
332 | > Wstrzykuje CSS w `InAppBrowser` okna.
333 |
334 | ref.insertCSS(details, callback);
335 |
336 |
337 | * **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)*
338 |
339 | * **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)*
340 |
341 | * **plik**: URL arkusza stylów do wsuwania.
342 | * **Kod**: tekst z arkusza stylów do wstrzykiwania.
343 |
344 | * **wywołania zwrotnego**: funkcja, która wykonuje po CSS jest wstrzykiwany.
345 |
346 | ### Obsługiwane platformy
347 |
348 | * Amazon Fire OS
349 | * Android
350 | * iOS
351 |
352 | ### Szybki przykład
353 |
354 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
355 | ref.addEventListener('loadstop', function() {
356 | ref.insertCSS({file: "mystyles.css"});
357 | });
358 |
--------------------------------------------------------------------------------