├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── RELEASENOTES.md ├── doc └── images │ ├── android_menu_sample_01.png │ ├── android_sample_01.png │ ├── ios_menu_sample_01.png │ └── ios_sample_01.png ├── legacy_doc ├── README.md ├── de │ └── index.md ├── es │ └── index.md ├── fr │ └── index.md ├── it │ └── index.md ├── ja │ └── index.md ├── ko │ └── index.md ├── pl │ └── index.md ├── ru │ └── index.md └── zh │ └── index.md ├── package.json ├── plugin.xml ├── src ├── amazon │ ├── InAppBrowser.java │ └── InAppChromeClient.java ├── android │ ├── InAppChromeClient.java │ ├── ThemeableBrowser.java │ ├── ThemeableBrowserDialog.java │ ├── ThemeableBrowserUnmarshaller.java │ └── res │ │ └── drawable-xhdpi │ │ ├── back.png │ │ ├── back_pressed.png │ │ ├── close.png │ │ ├── close_pressed.png │ │ ├── forward.png │ │ ├── forward_pressed.png │ │ ├── menu.png │ │ ├── menu_pressed.png │ │ ├── share.png │ │ └── share_pressed.png ├── blackberry10 │ └── README.md ├── browser │ └── InAppBrowserProxy.js ├── firefoxos │ └── InAppBrowserProxy.js ├── ios │ ├── CDVThemeableBrowser.h │ ├── CDVThemeableBrowser.m │ └── Resources │ │ ├── README.md │ │ ├── back@2x.png │ │ ├── back_pressed@2x.png │ │ ├── close@2x.png │ │ ├── close_pressed@2x.png │ │ ├── forward@2x.png │ │ ├── forward_pressed@2x.png │ │ ├── menu@2x.png │ │ ├── menu_pressed@2x.png │ │ ├── share@2x.png │ │ └── share_pressed@2x.png ├── ubuntu │ ├── InAppBrowser.qml │ ├── InAppBrowser_escapeScript.js │ ├── close.png │ ├── inappbrowser.cpp │ └── inappbrowser.h ├── windows │ └── InAppBrowserProxy.js └── wp │ └── InAppBrowser.cs ├── tests ├── plugin.xml ├── resources │ ├── inject.css │ ├── inject.html │ ├── inject.js │ ├── local.html │ ├── local.pdf │ └── video.html └── tests.js └── www ├── inappbrowser.css ├── themeablebrowser.js └── windows8 └── InAppBrowserProxy.js /.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 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | Release Notes 22 | ============= 23 | 24 | 0.2.17 25 | ------ 26 | 27 | Bug fix: remove hardcoded density value and add correct param 28 | Bug fix: Open iTunes Store links in AppStore app for iOS 29 | 30 | 0.2.15 31 | ------ 32 | 33 | Bug fix: fixes typo 34 | 35 | 0.2.14 36 | ------ 37 | 38 | Bug fix for: not building in cordova 6.0.0 cordova-ios 4.0+ 39 | Note: you might need to update the in config.xml for cordova 6.0+ 40 | 41 | 0.2.13 42 | ------ 43 | 44 | Bug fix for: Fix for ERR_UNKNOWN_URL_SCHEME for common URL scms 45 | 46 | 47 | 0.2.12 48 | ------ 49 | 50 | Bug fixes. 51 | 52 | 0.2.11 53 | ------ 54 | 55 | Expanded wwwImage feature to toolbar. 56 | 57 | 0.2.10 58 | ------ 59 | 60 | Added a experimental feature to allow loading images from assets instead of native resources. 61 | 62 | 0.2.9 63 | ----- 64 | 65 | Bug fixes. 66 | 67 | 0.2.8 68 | ----- 69 | 70 | No functional change. Migrated to npm as per Cordova's direction. 71 | 72 | 0.2.7 73 | ----- 74 | 75 | Bug fixes. Merged changes from upstream (InAppBrowser). Added fullscreen feature. 76 | 77 | 0.2.6 78 | ----- 79 | 80 | Bug fixes. 81 | 82 | 0.2.5 83 | ----- 84 | 85 | Bug fixes. 86 | 87 | 0.2.4 88 | ----- 89 | 90 | Added a reload feature. Better iOS implementation to improve backward compatibility and reduce the amount of hacks. 91 | 92 | 0.2.3 93 | ----- 94 | 95 | Bug fixes. 96 | 97 | 0.2.2 98 | ----- 99 | 100 | Added error and warning reporting capabilities. Added property to disable animation. 101 | 102 | 0.2.1 103 | ----- 104 | 105 | Debug and stablization. 106 | 107 | 0.2.0 108 | ----- 109 | 110 | Major improvement and resign of API to make it much more powerful and elegant. 111 | 112 | 0.1.2 113 | ----- 114 | 115 | No code change was made. Legacy doc was moved to prevent Cordova plugin registry from picking them up. 116 | 117 | 0.1.1 118 | ----- 119 | 120 | No code change was made. Doc was updated. Version number was updated because plugman wouldn't publish the 1.0. 121 | 122 | 0.1 123 | --- 124 | 125 | Initial release. 126 | -------------------------------------------------------------------------------- /doc/images/android_menu_sample_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/doc/images/android_menu_sample_01.png -------------------------------------------------------------------------------- /doc/images/android_sample_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/doc/images/android_sample_01.png -------------------------------------------------------------------------------- /doc/images/ios_menu_sample_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/doc/images/ios_menu_sample_01.png -------------------------------------------------------------------------------- /doc/images/ios_sample_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/doc/images/ios_sample_01.png -------------------------------------------------------------------------------- /legacy_doc/README.md: -------------------------------------------------------------------------------- 1 | This directory is deprecated. It contains legacy files from [InAppBrowser](https://github.com/apache/cordova-plugin-inappbrowser). They are kept here to make potential merge and/or pull easier and keep better track of file histories. -------------------------------------------------------------------------------- /legacy_doc/de/index.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # cordova-plugin-inappbrowser 21 | 22 | Dieses Plugin bietet eine Web-Browser-Ansicht, die beim Aufruf von `cordova.InAppBrowser.open()`. 23 | 24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 25 | 26 | 27 | Die `cordova.InAppBrowser.open()` Funktion ist definiert als Ersatz für die `window.open()` Funktion. InAppBrowser Fenster, können vorhandene `window.open()` Aufrufe durch window.open ersetzen: 28 | 29 | window.open = cordova.InAppBrowser.open; 30 | 31 | 32 | Das InAppBrowser-Fenster verhält sich wie einen standard-Webbrowser und Cordova APIs kann nicht zugegriffen werden kann. Aus diesem Grund empfiehlt sich die InAppBrowser Wenn Sie von Drittanbietern (nicht vertrauenswürdige) Inhalte, statt zu laden, die in den wichtigsten Cordova Webview laden müssen. Die InAppBrowser unterliegt nicht der weißen Liste, noch ist Links in der Systembrowser öffnen. 33 | 34 | Die InAppBrowser bietet standardmäßig eine eigene GUI-Steuerelemente für den Benutzer (zurück, vor, erledigt). 35 | 36 | Für rückwärts Kompatibilität, dieses Plugin auch `window.open` Haken. Jedoch kann der Plugin installiert Haken der `window.open` haben unbeabsichtigte Nebenwirkungen (vor allem, wenn dieses Plugin nur als eine Abhängigkeit von einem anderen Plugin enthalten ist). Der Haken der `window.open` wird in einer zukünftigen Version entfernt. Bis der Haken aus dem Plugin entfernt wird, können die Vorgabe von apps manuell wiederherstellen: 37 | 38 | delete window.open // Reverts the call back to it's prototype's default 39 | 40 | 41 | `window.open` im globalen Gültigkeitsbereich ist zwar InAppBrowser nicht verfügbar bis nach dem `deviceready`-Ereignis. 42 | 43 | document.addEventListener("deviceready", onDeviceReady, false); 44 | function onDeviceReady() { 45 | console.log("window.open works well"); 46 | } 47 | 48 | 49 | ## Installation 50 | 51 | cordova plugin add cordova-plugin-inappbrowser 52 | 53 | 54 | Wenn Sie alle Seite Lasten in Ihrer Anwendung durch die InAppBrowser gehen möchten, können Sie einfach `window.open` während der Initialisierung Haken. Zum Beispiel: 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 | Öffnet eine URL in eine neue `InAppBrowser`-Instanz, die aktuelle Browserinstanz oder der Systembrowser. 65 | 66 | var ref = cordova.InAppBrowser.open(url, target, options); 67 | 68 | 69 | * **Ref**: Bezugnahme auf das `InAppBrowser` Fenster. *(InAppBrowser)* 70 | 71 | * **URL**: die URL um den *(String)* zu laden. Rufen Sie `encodeURI()` auf, wenn die URL Unicode-Zeichen enthält. 72 | 73 | * **target**: das Ziel in welchem die URL geladen werden soll. Standardmäßig entspricht dieser Wert `_self` . *(String)* 74 | 75 | * `_self`: Öffnet sich in der Cordova WebView wenn der URL in der Whitelist ist, andernfalls es öffnet sich in der`InAppBrowser`. 76 | * `_blank`: Öffnet den`InAppBrowser`. 77 | * `_system`: Öffnet in den System-Web-Browser. 78 | 79 | * **options**: Optionen für die `InAppBrowser` . Optional, säumige an: `location=yes` . *(String)* 80 | 81 | Die `options` Zeichenfolge muss keine Leerstelle enthalten, und jede Funktion Name/Wert-Paare müssen durch ein Komma getrennt werden. Featurenamen Groß-/Kleinschreibung. Alle Plattformen unterstützen die anderen Werte: 82 | 83 | * **location**: Legen Sie auf `yes` oder `no` , machen die `InAppBrowser` der Adressleiste ein- oder ausschalten. 84 | 85 | Nur Android: 86 | 87 | * **hidden**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. 88 | * **clearcache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird 89 | * **clearsessioncache**: Legen Sie auf `yes` zu der Session Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird 90 | 91 | iOS nur: 92 | 93 | * **closebuttoncaption**: Legen Sie auf eine Zeichenfolge als Beschriftung der **fertig** -Schaltfläche verwenden. Beachten Sie, dass Sie diesen Wert selbst zu lokalisieren müssen. 94 | * **disallowoverscroll**: Legen Sie auf `yes` oder `no` (Standard ist `no` ). Aktiviert/deaktiviert die UIWebViewBounce-Eigenschaft. 95 | * **hidden**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. 96 | * **clearcache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird 97 | * **clearsessioncache**: Legen Sie auf `yes` zu der Session Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird 98 | * **toolbar**: Legen Sie auf `yes` oder `no` Aktivieren Sie die Symbolleiste ein- oder Ausschalten für InAppBrowser (Standard:`yes`) 99 | * **enableViewportScale**: Legen Sie auf `yes` oder `no` , Viewport Skalierung durch ein Meta-Tag (standardmäßig zu verhindern`no`). 100 | * **mediaPlaybackRequiresUserAction**: Legen Sie auf `yes` oder `no` , HTML5 audio oder video von automatisches Abspielen (standardmäßig zu verhindern`no`). 101 | * **allowInlineMediaPlayback**: Legen Sie auf `yes` oder `no` Inline-HTML5-Media-Wiedergabe, Darstellung im Browser-Fenster, sondern in eine gerätespezifische Wiedergabe-Schnittstelle ermöglichen. Des HTML `video` Element muss auch die `webkit-playsinline` Attribut (Standard:`no`) 102 | * **keyboardDisplayRequiresUserAction**: Legen Sie auf `yes` oder `no` um die Tastatur zu öffnen, wenn Formularelemente Fokus per JavaScript erhalten `focus()` Anruf (Standard:`yes`). 103 | * **suppressesIncrementalRendering**: Legen Sie auf `yes` oder `no` zu warten, bis alle neuen anzeigen-Inhalte empfangen wird, bevor Sie wiedergegeben wird (standardmäßig`no`). 104 | * **presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][1] (standardmäßig fest`fullscreen`). 105 | * **transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][2] (standardmäßig fest`coververtical`). 106 | * **toolbarposition**: Legen Sie auf `top` oder `bottom` (Standard ist `bottom` ). Bewirkt, dass die Symbolleiste am oberen oder unteren Rand des Fensters sein. 107 | 108 | Nur Windows: 109 | 110 | * **hidden**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. 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 | ### Unterstützte Plattformen 116 | 117 | * Amazon Fire OS 118 | * Android 119 | * BlackBerry 10 120 | * Firefox OS 121 | * iOS 122 | * Windows 8 und 8.1 123 | * Windows Phone 7 und 8 124 | 125 | ### Beispiel 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 Macken 132 | 133 | Als Plugin jedes Design erzwingen nicht besteht die Notwendigkeit, einige CSS-Regeln hinzuzufügen, wenn bei `target='_blank'`. Die Regeln könnte wie diese aussehen. 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 | Bei einem Aufruf von `cordova.InAppBrowser.open` zurückgegebene Objekt.. 164 | 165 | ### Methoden 166 | 167 | * addEventListener 168 | * removeEventListener 169 | * Schließen 170 | * Karte 171 | * executeScript 172 | * insertCSS 173 | 174 | ## addEventListener 175 | 176 | > Fügt einen Listener für eine Veranstaltung aus der`InAppBrowser`. 177 | 178 | ref.addEventListener(eventname, callback); 179 | 180 | 181 | * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* 182 | 183 | * **EventName**: das Ereignis zu warten *(String)* 184 | 185 | * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. 186 | * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. 187 | * **LoadError**: Ereignis wird ausgelöst, wenn der `InAppBrowser` ein Fehler auftritt, wenn Sie eine URL zu laden. 188 | * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. 189 | 190 | * **Rückruf**: die Funktion, die ausgeführt wird, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` -Objekt als Parameter. 191 | 192 | ### InAppBrowserEvent Eigenschaften 193 | 194 | * **Typ**: Eventname, entweder `loadstart` , `loadstop` , `loaderror` , oder `exit` . *(String)* 195 | 196 | * **URL**: die URL, die geladen wurde. *(String)* 197 | 198 | * **Code**: der Fehler-Code, nur im Fall von `loaderror` . *(Anzahl)* 199 | 200 | * **Nachricht**: die Fehlermeldung angezeigt, nur im Fall von `loaderror` . *(String)* 201 | 202 | ### Unterstützte Plattformen 203 | 204 | * Amazon Fire OS 205 | * Android 206 | * iOS 207 | * Windows 8 und 8.1 208 | * Windows Phone 7 und 8 209 | 210 | ### Kurzes Beispiel 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 | > Entfernt einen Listener für eine Veranstaltung aus der`InAppBrowser`. 219 | 220 | ref.removeEventListener(eventname, callback); 221 | 222 | 223 | * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* 224 | 225 | * **EventName**: das Ereignis zu warten. *(String)* 226 | 227 | * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. 228 | * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. 229 | * **LoadError**: Ereignis wird ausgelöst, wenn die `InAppBrowser` trifft einen Fehler beim Laden einer URLs. 230 | * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. 231 | 232 | * **Rückruf**: die Funktion ausgeführt, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` Objekt. 233 | 234 | ### Unterstützte Plattformen 235 | 236 | * Amazon Fire OS 237 | * Android 238 | * iOS 239 | * Windows 8 und 8.1 240 | * Windows Phone 7 und 8 241 | 242 | ### Kurzes Beispiel 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 | ## Schließen 251 | 252 | > Schließt die `InAppBrowser` Fenster. 253 | 254 | ref.close(); 255 | 256 | 257 | * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* 258 | 259 | ### Unterstützte Plattformen 260 | 261 | * Amazon Fire OS 262 | * Android 263 | * Firefox OS 264 | * iOS 265 | * Windows 8 und 8.1 266 | * Windows Phone 7 und 8 267 | 268 | ### Kurzes Beispiel 269 | 270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 271 | ref.close(); 272 | 273 | 274 | ## Karte 275 | 276 | > Zeigt ein InAppBrowser-Fenster, das geöffnet wurde, versteckt. Aufrufen, dies hat keine Auswirkungen, wenn die InAppBrowser schon sichtbar war. 277 | 278 | ref.show(); 279 | 280 | 281 | * **Ref**: Verweis auf die (InAppBrowser) Fenster`InAppBrowser`) 282 | 283 | ### Unterstützte Plattformen 284 | 285 | * Amazon Fire OS 286 | * Android 287 | * iOS 288 | * Windows 8 und 8.1 289 | 290 | ### Kurzes Beispiel 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 | > Fügt JavaScript-Code in das `InAppBrowser` Fenster 300 | 301 | ref.executeScript(details, callback); 302 | 303 | 304 | * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* 305 | 306 | * **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* 307 | 308 | * **Datei**: URL des Skripts zu injizieren. 309 | * **Code**: Text des Skripts zu injizieren. 310 | 311 | * **Rückruf**: die Funktion, die ausgeführt wird, nachdem der JavaScript-Code injiziert wird. 312 | 313 | * Wenn das eingefügte Skript vom Typ ist `code` , der Rückruf führt mit einen einzelnen Parameter, der der Rückgabewert des Skripts ist, umwickelt ein `Array` . Bei Multi-Line-Skripten ist der Rückgabewert von der letzten Anweisung oder den letzten Ausdruck ausgewertet. 314 | 315 | ### Unterstützte Plattformen 316 | 317 | * Amazon Fire OS 318 | * Android 319 | * iOS 320 | * Windows 8 und 8.1 321 | 322 | ### Kurzes Beispiel 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 | > Injiziert CSS in der `InAppBrowser` Fenster. 333 | 334 | ref.insertCSS(details, callback); 335 | 336 | 337 | * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* 338 | 339 | * **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* 340 | 341 | * **Datei**: URL des Stylesheets zu injizieren. 342 | * **Code**: Text des Stylesheets zu injizieren. 343 | 344 | * **Rückruf**: die Funktion, die ausgeführt wird, nachdem die CSS injiziert wird. 345 | 346 | ### Unterstützte Plattformen 347 | 348 | * Amazon Fire OS 349 | * Android 350 | * iOS 351 | 352 | ### Kurzes Beispiel 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 | -------------------------------------------------------------------------------- /legacy_doc/es/index.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # cordova-plugin-inappbrowser 21 | 22 | Este plugin proporciona una vista de navegador web que se muestra cuando se llama a `cordova.InAppBrowser.open()`. 23 | 24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 25 | 26 | 27 | El `cordova.InAppBrowser.open()` función se define como un reemplazo de sobreponer para la función `window.Open ()`. Llamadas existentes `window.Open ()` pueden utilizar la ventana InAppBrowser, mediante la sustitución de window.open: 28 | 29 | window.open = cordova.InAppBrowser.open; 30 | 31 | 32 | La ventana de InAppBrowser se comporta como un navegador web estándar y no puede acceder a Cordova APIs. Por este motivo, se recomienda la InAppBrowser si necesita cargar contenido de terceros (confianza), en lugar de que cargar en el principal webview Cordova. El InAppBrowser no está sujeta a la lista blanca, ni va a abrir enlaces en el navegador del sistema. 33 | 34 | El InAppBrowser proporciona por defecto sus propios controles GUI para el usuario (atras, adelante, hacer). 35 | 36 | Para atrás compatibilidad, este plugin también ganchos `window.open`. Sin embargo, el gancho de `window.open` plugin instalado puede tener efectos secundarios no deseados (especialmente si este plugin está incluido únicamente como una dependencia de otro plugin). El gancho de `window.open` se quitará en una versión futura de principal. Hasta que el gancho se ha extraído el plugin, aplicaciones pueden restaurar manualmente el comportamiento por defecto: 37 | 38 | delete window.open // Reverts the call back to it's prototype's default 39 | 40 | 41 | Aunque `window.open` es en el ámbito global, InAppBrowser no está disponible hasta después del evento `deviceready`. 42 | 43 | document.addEventListener("deviceready", onDeviceReady, false); 44 | function onDeviceReady() { 45 | console.log("window.open works well"); 46 | } 47 | 48 | 49 | ## Instalación 50 | 51 | cordova plugin add cordova-plugin-inappbrowser 52 | 53 | 54 | Si quieres todas las cargas de página en su aplicación para ir a través de la InAppBrowser, simplemente puedes conectar `window.open` durante la inicialización. Por ejemplo: 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 | Se abre una dirección URL en una nueva instancia de `InAppBrowser`, en la instancia actual del navegador o el navegador del sistema. 65 | 66 | var ref = cordova.InAppBrowser.open(url, target, options); 67 | 68 | 69 | * **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* 70 | 71 | * **url**: el URL para cargar *(String)*. Llame a `encodeURI()` en esto si la URL contiene caracteres Unicode. 72 | 73 | * **target**: el objetivo en el que se carga la URL, un parámetro opcional que se utiliza de forma predeterminada `_self`. *(String)* 74 | 75 | * `_self`: se abre en el Cordova WebView si la URL está en la lista blanca, de lo contrario se abre en el `InAppBrowser`. 76 | * `_blank`: abre en el `InAppBrowser`. 77 | * `_system`: se abre en el navegador del sistema. 78 | 79 | * **options**: opciones para el `InAppBrowser`. Opcional, contumaz a: `location=yes`. *(String)* 80 | 81 | La cadena de `options` no debe contener ningún espacio en blanco, y los pares de nombre y valor de cada característica deben estar separados por una coma. Los nombres de función son minúsculas. Todas las plataformas admiten el valor siguiente: 82 | 83 | * **location**: se establece en `yes` o `no` para activar o desactivar la barra de ubicación de la `InAppBrowser`. 84 | 85 | Sólo Android: 86 | 87 | * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o establecer en `no` (por defecto) para que el navegador abra y carga normalmente. 88 | * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana 89 | * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana 90 | 91 | Sólo iOS: 92 | 93 | * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . Tenga en cuenta que necesitas localizar este valor por sí mismo. 94 | * **disallowoverscroll**: A `yes` o `no` (valor por defecto es `no` ). Activa/desactiva la propiedad UIWebViewBounce. 95 | * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. 96 | * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana 97 | * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana 98 | * **barra de herramientas**: a `yes` o `no` para activar la barra de herramientas on u off para el InAppBrowser (por defecto`yes`) 99 | * **enableViewportScale**: Set a `yes` o `no` para evitar viewport escalar a través de una etiqueta meta (por defecto a `no`). 100 | * **mediaPlaybackRequiresUserAction**: Set a `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto a `no`). 101 | * **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. Elemento `video` de HTML también debe incluir el atributo de `webkit-playsinline` (por defecto a `no`) 102 | * **keyboardDisplayRequiresUserAction**: se establece en `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante llamada de JavaScript de `focus()` (por defecto a `yes`). 103 | * **suppressesIncrementalRendering**: se establece en `yes` o `no` para esperar hasta que todos los nuevos contenidos de vista se recibieron antes de ser prestados (por defecto a `no`). 104 | * **presentationstyle**: se establece en `pagesheet`, `formsheet` o `fullscreen` para definir el [estilo de la presentación][1] (por defecto a `fullscreen`). 105 | * **transitionstyle**: se establece en `fliphorizontal`, `crossdissolve` o `coververtical` para definir el [estilo de transición][2] (por defecto `coververtical`). 106 | * **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana. 107 | 108 | Sólo Windows: 109 | 110 | * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. 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 | ### Plataformas soportadas 116 | 117 | * Amazon fire OS 118 | * Android 119 | * BlackBerry 10 120 | * Firefox OS 121 | * iOS 122 | * Windows 8 y 8.1 123 | * Windows Phone 7 y 8 124 | 125 | ### Ejemplo 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 rarezas 132 | 133 | Como plugin no cumplir cualquier diseño es necesario añadir algunas reglas CSS si abre con `target = '_blank'`. Las reglas pueden parecerse a estos 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 | El objeto devuelto desde una llamada a `cordova.InAppBrowser.open`. 164 | 165 | ### Métodos 166 | 167 | * addEventListener 168 | * removeEventListener 169 | * close 170 | * show 171 | * executeScript 172 | * insertCSS 173 | 174 | ## addEventListener 175 | 176 | > Añade un detector para un evento de la `InAppBrowser`. 177 | 178 | ref.addEventListener(eventname, callback); 179 | 180 | 181 | * **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)* 182 | 183 | * **eventName**: el evento para escuchar *(String)* 184 | 185 | * **loadstart**: evento se desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. 186 | * **loadstop**: evento desencadena cuando los acabados `InAppBrowser` cargar una dirección URL. 187 | * **loaderror**: evento se desencadena cuando el `InAppBrowser` encuentra un error al cargar una dirección URL. 188 | * **exit**: evento se desencadena cuando se cierra la ventana de `InAppBrowser`. 189 | 190 | * **callback**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un objeto `InAppBrowserEvent` como un parámetro. 191 | 192 | ### InAppBrowserEvent propiedades 193 | 194 | * **type**: eventname, `loadstart`, `loadstop`, `loaderror` o `exit`. *(String)* 195 | 196 | * **url**: la URL que se cargó. *(String)* 197 | 198 | * **code**: el código de error, sólo en el caso de `loaderror`. *(Número)* 199 | 200 | * **message**: el mensaje de error, sólo en el caso de `loaderror`. *(String)* 201 | 202 | ### Plataformas soportadas 203 | 204 | * Amazon fire OS 205 | * Android 206 | * iOS 207 | * Windows 8 y 8.1 208 | * Windows Phone 7 y 8 209 | 210 | ### Ejemplo rápido 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 | > Elimina un detector para un evento de la `InAppBrowser`. 219 | 220 | ref.removeEventListener(eventname, callback); 221 | 222 | 223 | * **ref**: referencia a la ventana de `InAppBrowser`. *(InAppBrowser)* 224 | 225 | * **eventName**: dejar de escuchar para el evento. *(String)* 226 | 227 | * **loadstart**: evento se desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. 228 | * **loadstop**: evento desencadena cuando los acabados `InAppBrowser` cargar una dirección URL. 229 | * **loaderror**: evento se desencadena cuando el `InAppBrowser` se encuentra con un error al cargar una dirección URL. 230 | * **exit**: evento se desencadena cuando se cierra la ventana de `InAppBrowser`. 231 | 232 | * **callback**: la función a ejecutar cuando se desencadene el evento. La función se pasa un objeto `InAppBrowserEvent`. 233 | 234 | ### Plataformas soportadas 235 | 236 | * Amazon fire OS 237 | * Android 238 | * iOS 239 | * Windows 8 y 8.1 240 | * Windows Phone 7 y 8 241 | 242 | ### Ejemplo rápido 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 | > Cierra la ventana de `InAppBrowser`. 253 | 254 | ref.close(); 255 | 256 | 257 | * **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)* 258 | 259 | ### Plataformas soportadas 260 | 261 | * Amazon fire OS 262 | * Android 263 | * Firefox OS 264 | * iOS 265 | * Windows 8 y 8.1 266 | * Windows Phone 7 y 8 267 | 268 | ### Ejemplo rápido 269 | 270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 271 | ref.close(); 272 | 273 | 274 | ## show 275 | 276 | > Muestra una ventana InAppBrowser que abrió sus puertas ocultada. Esto no tiene efecto si el InAppBrowser ya era visible. 277 | 278 | ref.show(); 279 | 280 | 281 | * **ref**: referencia a la (ventana) InAppBrowser`InAppBrowser`) 282 | 283 | ### Plataformas soportadas 284 | 285 | * Amazon fire OS 286 | * Android 287 | * iOS 288 | * Windows 8 y 8.1 289 | 290 | ### Ejemplo rápido 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 | > Inyecta código JavaScript en la ventana de `InAppBrowser` 300 | 301 | ref.executeScript(details, callback); 302 | 303 | 304 | * **ref**: referencia a la ventana de `InAppBrowser`. *(InAppBrowser)* 305 | 306 | * **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* 307 | 308 | * **file**: URL del script para inyectar. 309 | * **code**: texto de la escritura para inyectar. 310 | 311 | * **devolución de llamada**: la función que se ejecuta después de inyecta el código JavaScript. 312 | 313 | * Si el script inyectado es del tipo de `code`, la devolución de llamada se ejecuta con un solo parámetro, que es el valor devuelto del guión, envuelto en una `Array`. Para scripts multilíneas, este es el valor devuelto de la última declaración, o la última expresión evaluada. 314 | 315 | ### Plataformas soportadas 316 | 317 | * Amazon fire OS 318 | * Android 319 | * iOS 320 | * Windows 8 y 8.1 321 | 322 | ### Ejemplo rápido 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 | > Inyecta CSS en la ventana de `InAppBrowser`. 333 | 334 | ref.insertCSS(details, callback); 335 | 336 | 337 | * **ref**: referencia a la ventana de `InAppBrowser` *(InAppBrowser)* 338 | 339 | * **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* 340 | 341 | * **file**: URL de la hoja de estilos para inyectar. 342 | * **code**: texto de la hoja de estilos para inyectar. 343 | 344 | * **callback**: la función que se ejecuta después de inyectar el CSS. 345 | 346 | ### Plataformas soportadas 347 | 348 | * Amazon fire OS 349 | * Android 350 | * iOS 351 | 352 | ### Ejemplo rápido 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 | -------------------------------------------------------------------------------- /legacy_doc/it/index.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # cordova-plugin-inappbrowser 21 | 22 | Questo plugin fornisce una vista di browser web che viene visualizzato quando si chiama `di cordova.InAppBrowser.open()`. 23 | 24 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 25 | 26 | 27 | Il `cordova.InAppBrowser.open()` funzione è definita per essere un rimpiazzo per la funzione `window.open`. Esistenti chiamate `Window` possono utilizzare la finestra di InAppBrowser, sostituendo window.open(): 28 | 29 | window.open = cordova.InAppBrowser.open; 30 | 31 | 32 | La finestra di InAppBrowser si comporta come un browser web standard e non può accedere a Cordova APIs. Per questo motivo, è consigliabile la InAppBrowser se è necessario caricare il contenuto (non attendibile) di terze parti, invece di caricamento che in webview Cordova principale. Il InAppBrowser non è soggetto alla whitelist, né sta aprendo il link nel browser di sistema. 33 | 34 | La InAppBrowser fornisce di default propri controlli GUI per l'utente (indietro, avanti, fatto). 35 | 36 | Per indietro la compatibilità, questo plugin ganci anche `window.open`. Tuttavia, il plugin installato gancio di `window.open` può avere effetti collaterali indesiderati (soprattutto se questo plugin è incluso solo come dipendenza di un altro plugin). Il gancio di `window. open` verrà rimosso in una futura release principale. Fino a quando il gancio è rimosso dal plugin, apps può ripristinare manualmente il comportamento predefinito: 37 | 38 | delete window.open // Reverts the call back to it's prototype's default 39 | 40 | 41 | Sebbene `window.open` sia in ambito globale, InAppBrowser non è disponibile fino a dopo l'evento `deviceready`. 42 | 43 | document.addEventListener("deviceready", onDeviceReady, false); 44 | function onDeviceReady() { 45 | console.log("window.open works well"); 46 | } 47 | 48 | 49 | ## Installazione 50 | 51 | cordova plugin add cordova-plugin-inappbrowser 52 | 53 | 54 | Se si desidera che tutti i carichi di pagina nell'app di passare attraverso il InAppBrowser, si può semplicemente collegare `window.open` durante l'inizializzazione. Per esempio: 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 | Apre un URL in una nuova istanza di `InAppBrowser`, l'istanza corrente del browser o il browser di sistema. 65 | 66 | var ref = cordova.InAppBrowser.open(url, target, options); 67 | 68 | 69 | * **ref**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* 70 | 71 | * **url**: l'URL da caricare *(String)*. Chiamare `encodeURI()` su questo, se l'URL contiene caratteri Unicode. 72 | 73 | * **target**: la destinazione in cui caricare l'URL, un parametro facoltativo che il valore predefinito è `_self` . *(String)* 74 | 75 | * `_self`: Si apre in Cordova WebView se l'URL è nella lista bianca, altrimenti si apre nella`InAppBrowser`. 76 | * `_blank`: Apre il`InAppBrowser`. 77 | * `_system`: Si apre nel browser web del sistema. 78 | 79 | * **options**: opzioni per il `InAppBrowser` . Opzionale, inadempiente a: `location=yes` . *(String)* 80 | 81 | Il `options` stringa non deve contenere alcun spazio vuoto, e coppie nome/valore ogni funzionalità devono essere separate da una virgola. Caratteristica nomi sono tra maiuscole e minuscole. Tutte le piattaforme supportano il valore riportato di seguito: 82 | 83 | * **posizione**: impostata su `yes` o `no` per trasformare il `InAppBrowser` di barra di posizione on o off. 84 | 85 | Solo su Android: 86 | 87 | * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. 88 | * **ClearCache**: impostare su `yes` per avere il browser cache cookie ha lasciata prima dell'apertura della nuova finestra 89 | * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra 90 | 91 | solo iOS: 92 | 93 | * **closebuttoncaption**: impostare una stringa da utilizzare come didascalia del pulsante **fatto** . Si noti che è necessario localizzare questo valore a te stesso. 94 | * **disallowoverscroll**: impostare su `yes` o `no` (default è `no` ). Attiva/disattiva la proprietà UIWebViewBounce. 95 | * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. 96 | * **ClearCache**: impostare su `yes` per avere il browser cache cookie ha lasciata prima dell'apertura della nuova finestra 97 | * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra 98 | * **Toolbar**: impostare su `yes` o `no` per attivare la barra degli strumenti o disattivare per il InAppBrowser (default`yes`) 99 | * **enableViewportScale**: impostare su `yes` o `no` per impedire la viewport ridimensionamento tramite un tag meta (default`no`). 100 | * **mediaPlaybackRequiresUserAction**: impostare su `yes` o `no` per impedire HTML5 audio o video da AutoPlay (default`no`). 101 | * **allowInlineMediaPlayback**: impostare su `yes` o `no` per consentire la riproduzione dei supporti HTML5 in linea, visualizzare all'interno della finestra del browser, piuttosto che un'interfaccia specifica del dispositivo di riproduzione. L'HTML `video` elemento deve includere anche il `webkit-playsinline` (default di attributo`no`) 102 | * **keyboardDisplayRequiresUserAction**: impostare su `yes` o `no` per aprire la tastiera quando elementi form ricevano lo stato attivo tramite di JavaScript `focus()` chiamata (default`yes`). 103 | * **suppressesIncrementalRendering**: impostare su `yes` o `no` aspettare fino a quando tutti i nuovi contenuti di vista viene ricevuto prima il rendering (default`no`). 104 | * **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][1] (default`fullscreen`). 105 | * **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][2] (default`coververtical`). 106 | * **toolbarposition**: impostare su `top` o `bottom` (default è `bottom` ). Provoca la barra degli strumenti sia nella parte superiore o inferiore della finestra. 107 | 108 | Solo per Windows: 109 | 110 | * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. 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 | ### Piattaforme supportate 116 | 117 | * Amazon fuoco OS 118 | * Android 119 | * BlackBerry 10 120 | * Firefox OS 121 | * iOS 122 | * Windows 8 e 8.1 123 | * Windows Phone 7 e 8 124 | 125 | ### Esempio 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 stranezze 132 | 133 | Come plugin non imporre alcun disegno c'è bisogno di aggiungere alcune regole CSS se aperto con `target='_blank'`. Le regole potrebbero apparire come questi 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 | L'oggetto restituito da una chiamata a `di cordova.InAppBrowser.open`. 164 | 165 | ### Metodi 166 | 167 | * addEventListener 168 | * removeEventListener 169 | * close 170 | * show 171 | * executeScript 172 | * insertCSS 173 | 174 | ## addEventListener 175 | 176 | > Aggiunge un listener per un evento dal`InAppBrowser`. 177 | 178 | ref.addEventListener(eventname, callback); 179 | 180 | 181 | * **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* 182 | 183 | * **EventName**: l'evento per l'ascolto *(String)* 184 | 185 | * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. 186 | * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. 187 | * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore durante il caricamento di un URL. 188 | * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. 189 | 190 | * **richiamata**: la funzione che viene eseguito quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto come parametro. 191 | 192 | ### Proprietà InAppBrowserEvent 193 | 194 | * **tipo**: il eventname, o `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* 195 | 196 | * **URL**: l'URL che è stato caricato. *(String)* 197 | 198 | * **codice**: il codice di errore, solo nel caso di `loaderror` . *(Numero)* 199 | 200 | * **messaggio**: il messaggio di errore, solo nel caso di `loaderror` . *(String)* 201 | 202 | ### Piattaforme supportate 203 | 204 | * Amazon fuoco OS 205 | * Android 206 | * iOS 207 | * Windows 8 e 8.1 208 | * Windows Phone 7 e 8 209 | 210 | ### Esempio rapido 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 | > Rimuove un listener per un evento dal`InAppBrowser`. 219 | 220 | ref.removeEventListener(eventname, callback); 221 | 222 | 223 | * **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* 224 | 225 | * **EventName**: interrompere l'attesa per l'evento. *(String)* 226 | 227 | * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. 228 | * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. 229 | * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore di caricamento di un URL. 230 | * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. 231 | 232 | * **richiamata**: la funzione da eseguire quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto. 233 | 234 | ### Piattaforme supportate 235 | 236 | * Amazon fuoco OS 237 | * Android 238 | * iOS 239 | * Windows 8 e 8.1 240 | * Windows Phone 7 e 8 241 | 242 | ### Esempio rapido 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 | > Chiude la `InAppBrowser` finestra. 253 | 254 | ref.close(); 255 | 256 | 257 | * **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* 258 | 259 | ### Piattaforme supportate 260 | 261 | * Amazon fuoco OS 262 | * Android 263 | * Firefox OS 264 | * iOS 265 | * Windows 8 e 8.1 266 | * Windows Phone 7 e 8 267 | 268 | ### Esempio rapido 269 | 270 | var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes'); 271 | ref.close(); 272 | 273 | 274 | ## show 275 | 276 | > Visualizza una finestra di InAppBrowser che è stato aperto nascosta. Questa chiamata non ha effetto se la InAppBrowser era già visibile. 277 | 278 | ref.show(); 279 | 280 | 281 | * **Rif**: riferimento per il InAppBrowser finestra (`InAppBrowser`) 282 | 283 | ### Piattaforme supportate 284 | 285 | * Amazon fuoco OS 286 | * Android 287 | * iOS 288 | * Windows 8 e 8.1 289 | 290 | ### Esempio rapido 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 | > Inserisce il codice JavaScript nella `InAppBrowser` finestra 300 | 301 | ref.executeScript(details, callback); 302 | 303 | 304 | * **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* 305 | 306 | * **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* 307 | 308 | * **file**: URL dello script da iniettare. 309 | * **codice**: testo dello script da iniettare. 310 | 311 | * **richiamata**: la funzione che viene eseguito dopo che il codice JavaScript viene iniettato. 312 | 313 | * Se lo script iniettato è di tipo `code` , il callback viene eseguita con un singolo parametro, che è il valore restituito del copione, avvolto in un `Array` . Per gli script multi-linea, questo è il valore restituito dell'ultima istruzione, o l'ultima espressione valutata. 314 | 315 | ### Piattaforme supportate 316 | 317 | * Amazon fuoco OS 318 | * Android 319 | * iOS 320 | * Windows 8 e 8.1 321 | 322 | ### Esempio rapido 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 | > Inietta CSS nella `InAppBrowser` finestra. 333 | 334 | ref.insertCSS(details, callback); 335 | 336 | 337 | * **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* 338 | 339 | * **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* 340 | 341 | * **file**: URL del foglio di stile per iniettare. 342 | * **codice**: testo del foglio di stile per iniettare. 343 | 344 | * **richiamata**: la funzione che viene eseguito dopo che il CSS viene iniettato. 345 | 346 | ### Piattaforme supportate 347 | 348 | * Amazon fuoco OS 349 | * Android 350 | * iOS 351 | 352 | ### Esempio rapido 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 | -------------------------------------------------------------------------------- /legacy_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 | -------------------------------------------------------------------------------- /legacy_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 | -------------------------------------------------------------------------------- /legacy_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 | -------------------------------------------------------------------------------- /legacy_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 | -------------------------------------------------------------------------------- /legacy_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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-themeablebrowser", 3 | "version": "0.2.18", 4 | "description": "Cordova ThemeableBrowser Plugin", 5 | "cordova": { 6 | "id": "cordova-plugin-themeablebrowser", 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/initialxy/cordova-plugin-themeablebrowser" 22 | }, 23 | "keywords": [ 24 | "cordova", 25 | "in", 26 | "app", 27 | "browser", 28 | "themeablebrowser", 29 | "ecosystem:cordova", 30 | "cordova-android", 31 | "cordova-ios" 32 | ], 33 | "engines": [ 34 | { 35 | "name": "cordova", 36 | "version": ">=3.1.0" 37 | } 38 | ], 39 | "author": "Apache Software Foundation", 40 | "license": "Apache 2.0" 41 | } 42 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 25 | 26 | ThemeableBrowser 27 | Cordova ThemeableBrowser Plugin 28 | Apache 2.0 29 | cordova,in,app,browser,themeablebrowser 30 | https://github.com/initialxy/cordova-plugin-themeablebrowser.git 31 | https://github.com/initialxy/cordova-plugin-themeablebrowser/issues 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 | -------------------------------------------------------------------------------- /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/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 com.initialxy.cordova.themeablebrowser; 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.GeolocationPermissions.Callback; 32 | 33 | public class InAppChromeClient extends WebChromeClient { 34 | 35 | private CordovaWebView webView; 36 | private String LOG_TAG = "InAppChromeClient"; 37 | private long MAX_QUOTA = 100 * 1024 * 1024; 38 | 39 | public InAppChromeClient(CordovaWebView webView) { 40 | super(); 41 | this.webView = webView; 42 | } 43 | /** 44 | * Handle database quota exceeded notification. 45 | * 46 | * @param url 47 | * @param databaseIdentifier 48 | * @param currentQuota 49 | * @param estimatedSize 50 | * @param totalUsedQuota 51 | * @param quotaUpdater 52 | */ 53 | @Override 54 | public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize, 55 | long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) 56 | { 57 | LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota); 58 | quotaUpdater.updateQuota(MAX_QUOTA); 59 | } 60 | 61 | /** 62 | * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin. 63 | * 64 | * @param origin 65 | * @param callback 66 | */ 67 | @Override 68 | public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { 69 | super.onGeolocationPermissionsShowPrompt(origin, callback); 70 | callback.invoke(origin, true, false); 71 | } 72 | 73 | /** 74 | * Tell the client to display a prompt dialog to the user. 75 | * If the client returns true, WebView will assume that the client will 76 | * handle the prompt dialog and call the appropriate JsPromptResult method. 77 | * 78 | * The prompt bridge provided for the ThemeableBrowser is capable of executing any 79 | * oustanding callback belonging to the ThemeableBrowser plugin. Care has been 80 | * taken that other callbacks cannot be triggered, and that no other code 81 | * execution is possible. 82 | * 83 | * To trigger the bridge, the prompt default value should be of the form: 84 | * 85 | * gap-iab:// 86 | * 87 | * where is the string id of the callback to trigger (something 88 | * like "ThemeableBrowser0123456789") 89 | * 90 | * If present, the prompt message is expected to be a JSON-encoded value to 91 | * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid. 92 | * 93 | * @param view 94 | * @param url 95 | * @param message 96 | * @param defaultValue 97 | * @param result 98 | */ 99 | @Override 100 | public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { 101 | // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute. 102 | if (defaultValue != null && defaultValue.startsWith("gap")) { 103 | if(defaultValue.startsWith("gap-iab://")) { 104 | PluginResult scriptResult; 105 | String scriptCallbackId = defaultValue.substring(10); 106 | if (scriptCallbackId.startsWith("ThemeableBrowser")) { 107 | if(message == null || message.length() == 0) { 108 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray()); 109 | } else { 110 | try { 111 | scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message)); 112 | } catch(JSONException e) { 113 | scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage()); 114 | } 115 | } 116 | this.webView.sendPluginResult(scriptResult, scriptCallbackId); 117 | result.confirm(""); 118 | return true; 119 | } 120 | } 121 | else 122 | { 123 | // Anything else with a gap: prefix should get this message 124 | LOG.w(LOG_TAG, "ThemeableBrowser does not support Cordova API calls: " + url + " " + defaultValue); 125 | result.cancel(); 126 | return true; 127 | } 128 | } 129 | return false; 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /src/android/ThemeableBrowserDialog.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 com.initialxy.cordova.themeablebrowser; 20 | 21 | import android.app.AlertDialog; 22 | import android.app.Dialog; 23 | import android.content.Context; 24 | import android.util.Log; 25 | 26 | import org.json.JSONException; 27 | import org.json.JSONObject; 28 | 29 | /** 30 | * Created by Oliver on 22/11/2013. 31 | */ 32 | public class ThemeableBrowserDialog extends Dialog { 33 | Context context; 34 | ThemeableBrowser themeableBrowser = null; 35 | boolean hardwareBack; 36 | 37 | public ThemeableBrowserDialog(Context context, int theme, 38 | boolean hardwareBack) { 39 | super(context, theme); 40 | this.context = context; 41 | this.hardwareBack = hardwareBack; 42 | } 43 | 44 | public void setThemeableBrowser(ThemeableBrowser browser) { 45 | this.themeableBrowser = browser; 46 | } 47 | 48 | public void onBackPressed () { 49 | if (this.themeableBrowser == null) { 50 | this.dismiss(); 51 | } else { 52 | // better to go through in themeableBrowser because it does a clean 53 | // up 54 | if (this.hardwareBack && this.themeableBrowser.canGoBack()) { 55 | this.themeableBrowser.goBack(); 56 | } else { 57 | this.themeableBrowser.closeDialog(); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/back.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/back_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/back_pressed.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/close.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/close_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/close_pressed.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/forward.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/forward_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/forward_pressed.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/menu.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/menu_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/menu_pressed.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/share.png -------------------------------------------------------------------------------- /src/android/res/drawable-xhdpi/share_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/android/res/drawable-xhdpi/share_pressed.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 cordova = require('cordova'), 23 | channel = require('cordova/channel'), 24 | urlutil = require('cordova/urlutil'); 25 | 26 | var browserWrap, 27 | popup, 28 | navigationButtonsDiv, 29 | navigationButtonsDivInner, 30 | backButton, 31 | forwardButton, 32 | closeButton; 33 | 34 | function attachNavigationEvents(element, callback) { 35 | var onError = function () { 36 | callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true}); 37 | }; 38 | 39 | element.addEventListener("pageshow", function () { 40 | callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true}); 41 | }); 42 | 43 | element.addEventListener("load", function () { 44 | callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true}); 45 | }); 46 | 47 | element.addEventListener("error", onError); 48 | element.addEventListener("abort", onError); 49 | } 50 | 51 | var IAB = { 52 | close: function (win, lose) { 53 | if (browserWrap) { 54 | if (win) win({ type: "exit" }); 55 | 56 | browserWrap.parentNode.removeChild(browserWrap); 57 | browserWrap = null; 58 | popup = null; 59 | } 60 | }, 61 | 62 | show: function (win, lose) { 63 | if (browserWrap) { 64 | browserWrap.style.display = "block"; 65 | } 66 | }, 67 | 68 | open: function (win, lose, args) { 69 | var strUrl = args[0], 70 | target = args[1], 71 | features = args[2], 72 | url; 73 | 74 | if (target === "_system" || target === "_self" || !target) { 75 | window.location = strUrl; 76 | } else { 77 | // "_blank" or anything else 78 | if (!browserWrap) { 79 | browserWrap = document.createElement("div"); 80 | browserWrap.style.position = "absolute"; 81 | browserWrap.style.borderWidth = "40px"; 82 | browserWrap.style.width = "calc(100% - 80px)"; 83 | browserWrap.style.height = "calc(100% - 80px)"; 84 | browserWrap.style.borderStyle = "solid"; 85 | browserWrap.style.borderColor = "rgba(0,0,0,0.25)"; 86 | 87 | browserWrap.onclick = function () { 88 | setTimeout(function () { 89 | IAB.close(win); 90 | }, 0); 91 | }; 92 | 93 | document.body.appendChild(browserWrap); 94 | } 95 | 96 | if (features.indexOf("hidden=yes") !== -1) { 97 | browserWrap.style.display = "none"; 98 | } 99 | 100 | popup = document.createElement("iframe"); 101 | popup.style.borderWidth = "0px"; 102 | popup.style.width = "100%"; 103 | 104 | browserWrap.appendChild(popup); 105 | 106 | if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) { 107 | popup.style.height = "calc(100% - 60px)"; 108 | 109 | navigationButtonsDiv = document.createElement("div"); 110 | navigationButtonsDiv.style.height = "60px"; 111 | navigationButtonsDiv.style.backgroundColor = "#404040"; 112 | navigationButtonsDiv.style.zIndex = "999"; 113 | navigationButtonsDiv.onclick = function (e) { 114 | e.cancelBubble = true; 115 | }; 116 | 117 | navigationButtonsDivInner = document.createElement("div"); 118 | navigationButtonsDivInner.style.paddingTop = "10px"; 119 | navigationButtonsDivInner.style.height = "50px"; 120 | navigationButtonsDivInner.style.width = "160px"; 121 | navigationButtonsDivInner.style.margin = "0 auto"; 122 | navigationButtonsDivInner.style.backgroundColor = "#404040"; 123 | navigationButtonsDivInner.style.zIndex = "999"; 124 | navigationButtonsDivInner.onclick = function (e) { 125 | e.cancelBubble = true; 126 | }; 127 | 128 | 129 | backButton = document.createElement("button"); 130 | backButton.style.width = "40px"; 131 | backButton.style.height = "40px"; 132 | backButton.style.borderRadius = "40px"; 133 | 134 | backButton.innerHTML = "←"; 135 | backButton.addEventListener("click", function (e) { 136 | if (popup.canGoBack) 137 | popup.goBack(); 138 | }); 139 | 140 | forwardButton = document.createElement("button"); 141 | forwardButton.style.marginLeft = "20px"; 142 | forwardButton.style.width = "40px"; 143 | forwardButton.style.height = "40px"; 144 | forwardButton.style.borderRadius = "40px"; 145 | 146 | forwardButton.innerHTML = "→"; 147 | forwardButton.addEventListener("click", function (e) { 148 | if (popup.canGoForward) 149 | popup.goForward(); 150 | }); 151 | 152 | closeButton = document.createElement("button"); 153 | closeButton.style.marginLeft = "20px"; 154 | closeButton.style.width = "40px"; 155 | closeButton.style.height = "40px"; 156 | closeButton.style.borderRadius = "40px"; 157 | 158 | closeButton.innerHTML = "✖"; 159 | closeButton.addEventListener("click", function (e) { 160 | setTimeout(function () { 161 | IAB.close(win); 162 | }, 0); 163 | }); 164 | 165 | // iframe navigation is not yet supported 166 | backButton.disabled = true; 167 | forwardButton.disabled = true; 168 | 169 | navigationButtonsDivInner.appendChild(backButton); 170 | navigationButtonsDivInner.appendChild(forwardButton); 171 | navigationButtonsDivInner.appendChild(closeButton); 172 | navigationButtonsDiv.appendChild(navigationButtonsDivInner); 173 | 174 | browserWrap.appendChild(navigationButtonsDiv); 175 | } else { 176 | popup.style.height = "100%"; 177 | } 178 | 179 | // start listening for navigation events 180 | attachNavigationEvents(popup, win); 181 | 182 | popup.src = strUrl; 183 | } 184 | }, 185 | 186 | injectScriptCode: function (win, fail, args) { 187 | var code = args[0], 188 | hasCallback = args[1]; 189 | 190 | if (browserWrap && popup) { 191 | try { 192 | popup.contentWindow.eval(code); 193 | hasCallback && win([]); 194 | } catch(e) { 195 | console.error('Error occured while trying to injectScriptCode: ' + JSON.stringify(e)); 196 | } 197 | } 198 | }, 199 | 200 | injectScriptFile: function (win, fail, args) { 201 | var msg = 'Browser cordova-plugin-inappbrowser injectScriptFile is not yet implemented'; 202 | console.warn(msg); 203 | fail && fail(msg); 204 | }, 205 | 206 | injectStyleCode: function (win, fail, args) { 207 | var msg = 'Browser cordova-plugin-inappbrowser injectStyleCode is not yet implemented'; 208 | console.warn(msg); 209 | fail && fail(msg); 210 | }, 211 | 212 | injectStyleFile: function (win, fail, args) { 213 | var msg = 'Browser cordova-plugin-inappbrowser injectStyleFile is not yet implemented'; 214 | console.warn(msg); 215 | fail && fail(msg); 216 | } 217 | }; 218 | 219 | module.exports = IAB; 220 | 221 | require("cordova/exec/proxy").add("InAppBrowser", module.exports); 222 | -------------------------------------------------------------------------------- /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 cordova = require('cordova'), 25 | channel = require('cordova/channel'), 26 | modulemapper = require('cordova/modulemapper'); 27 | 28 | var origOpenFunc = modulemapper.getOriginalSymbol(window, 'window.open'); 29 | var browserWrap; 30 | 31 | var IABExecs = { 32 | 33 | close: function (win, lose) { 34 | if (browserWrap) { 35 | browserWrap.parentNode.removeChild(browserWrap); 36 | browserWrap = null; 37 | if (typeof(win) == "function") win({type:'exit'}); 38 | } 39 | }, 40 | 41 | /* 42 | * Reveal browser if opened hidden 43 | */ 44 | show: function (win, lose) { 45 | console.error('[FirefoxOS] show not implemented'); 46 | }, 47 | 48 | open: function (win, lose, args) { 49 | var strUrl = args[0], 50 | target = args[1], 51 | features_string = args[2] || "location=yes", //location=yes is default 52 | features = {}, 53 | url, 54 | elem; 55 | 56 | var features_list = features_string.split(','); 57 | features_list.forEach(function(feature) { 58 | var tup = feature.split('='); 59 | if (tup[1] == 'yes') { 60 | tup[1] = true; 61 | } else if (tup[1] == 'no') { 62 | tup[1] = false; 63 | } else { 64 | var number = parseInt(tup[1]); 65 | if (!isNaN(number)) { 66 | tup[1] = number; 67 | } 68 | } 69 | features[tup[0]] = tup[1]; 70 | }); 71 | 72 | function updateIframeSizeNoLocation() { 73 | browserWrap.style.width = window.innerWidth + 'px'; 74 | browserWrap.style.height = window.innerHeight + 'px'; 75 | browserWrap.style.zIndex = '999999999'; 76 | browserWrap.browser.style.height = (window.innerHeight - 60) + 'px'; 77 | browserWrap.browser.style.width = browserWrap.style.width; 78 | } 79 | 80 | if (target === '_system') { 81 | origOpenFunc.apply(window, [strUrl, '_blank']); 82 | } else if (target === '_blank') { 83 | var browserElem = document.createElement('iframe'); 84 | browserElem.setAttribute('mozbrowser', true); 85 | // make this loaded in its own child process 86 | browserElem.setAttribute('remote', true); 87 | browserElem.setAttribute('src', strUrl); 88 | if (browserWrap) { 89 | document.body.removeChild(browserWrap); 90 | } 91 | browserWrap = document.createElement('div'); 92 | // assign browser element to browserWrap for future reference 93 | browserWrap.browser = browserElem; 94 | 95 | browserWrap.classList.add('inAppBrowserWrap'); 96 | // position fixed so that it works even when page is scrolled 97 | browserWrap.style.position = 'fixed'; 98 | browserElem.style.position = 'absolute'; 99 | browserElem.style.border = 0; 100 | browserElem.style.top = '60px'; 101 | browserElem.style.left = '0px'; 102 | updateIframeSizeNoLocation(); 103 | 104 | var menu = document.createElement('menu'); 105 | menu.setAttribute('type', 'toolbar'); 106 | var close = document.createElement('li'); 107 | var back = document.createElement('li'); 108 | var forward = document.createElement('li'); 109 | 110 | close.appendChild(document.createTextNode('×')); 111 | back.appendChild(document.createTextNode('<')); 112 | forward.appendChild(document.createTextNode('>')); 113 | 114 | close.classList.add('inAppBrowserClose'); 115 | back.classList.add('inAppBrowserBack'); 116 | forward.classList.add('inAppBrowserForward'); 117 | 118 | function checkForwardBackward() { 119 | var backReq = browserElem.getCanGoBack(); 120 | backReq.onsuccess = function() { 121 | if (this.result) { 122 | back.classList.remove('disabled'); 123 | } else { 124 | back.classList.add('disabled'); 125 | } 126 | } 127 | var forwardReq = browserElem.getCanGoForward(); 128 | forwardReq.onsuccess = function() { 129 | if (this.result) { 130 | forward.classList.remove('disabled'); 131 | } else { 132 | forward.classList.add('disabled'); 133 | } 134 | } 135 | }; 136 | 137 | browserElem.addEventListener('mozbrowserloadend', checkForwardBackward); 138 | 139 | close.addEventListener('click', function () { 140 | setTimeout(function () { 141 | IABExecs.close(win, lose); 142 | }, 0); 143 | }, false); 144 | 145 | back.addEventListener('click', function () { 146 | browserElem.goBack(); 147 | }, false); 148 | 149 | forward.addEventListener('click', function () { 150 | browserElem.goForward(); 151 | }, false); 152 | 153 | menu.appendChild(back); 154 | menu.appendChild(forward); 155 | menu.appendChild(close); 156 | 157 | browserWrap.appendChild(menu); 158 | browserWrap.appendChild(browserElem); 159 | document.body.appendChild(browserWrap); 160 | 161 | //we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url 162 | browserElem.addEventListener('mozbrowserlocationchange', function(e){ 163 | win({ 164 | type:'loadstart', 165 | url : e.detail 166 | }) 167 | }, false); 168 | browserElem.addEventListener('mozbrowserloadend', function(e){ 169 | win({type:'loadstop'}) 170 | }, false); 171 | browserElem.addEventListener('mozbrowsererror', function(e){ 172 | win({type:'loaderror'}) 173 | }, false); 174 | browserElem.addEventListener('mozbrowserclose', function(e){ 175 | win({type:'exit'}) 176 | }, false); 177 | } else { 178 | window.location = strUrl; 179 | } 180 | }, 181 | injectScriptCode: function (code, bCB) { 182 | console.error('[FirefoxOS] injectScriptCode not implemented'); 183 | }, 184 | injectScriptFile: function (file, bCB) { 185 | console.error('[FirefoxOS] injectScriptFile not implemented'); 186 | } 187 | }; 188 | 189 | module.exports = IABExecs; 190 | 191 | require('cordova/exec/proxy').add('InAppBrowser', module.exports); 192 | -------------------------------------------------------------------------------- /src/ios/CDVThemeableBrowser.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 | @interface CDVThemeableBrowserOptions : NSObject {} 31 | 32 | @property (nonatomic) BOOL location; 33 | @property (nonatomic) NSString* closebuttoncaption; 34 | @property (nonatomic) NSString* toolbarposition; 35 | @property (nonatomic) BOOL clearcache; 36 | @property (nonatomic) BOOL clearsessioncache; 37 | 38 | @property (nonatomic) NSString* presentationstyle; 39 | @property (nonatomic) NSString* transitionstyle; 40 | 41 | @property (nonatomic) BOOL zoom; 42 | @property (nonatomic) BOOL mediaplaybackrequiresuseraction; 43 | @property (nonatomic) BOOL allowinlinemediaplayback; 44 | @property (nonatomic) BOOL keyboarddisplayrequiresuseraction; 45 | @property (nonatomic) BOOL suppressesincrementalrendering; 46 | @property (nonatomic) BOOL hidden; 47 | @property (nonatomic) BOOL disallowoverscroll; 48 | 49 | @property (nonatomic) NSDictionary* statusbar; 50 | @property (nonatomic) NSDictionary* toolbar; 51 | @property (nonatomic) NSDictionary* title; 52 | @property (nonatomic) NSDictionary* backButton; 53 | @property (nonatomic) NSDictionary* forwardButton; 54 | @property (nonatomic) NSDictionary* closeButton; 55 | @property (nonatomic) NSDictionary* menu; 56 | @property (nonatomic) NSArray* customButtons; 57 | @property (nonatomic) BOOL backButtonCanClose; 58 | @property (nonatomic) BOOL disableAnimation; 59 | @property (nonatomic) BOOL fullscreen; 60 | 61 | @end 62 | 63 | @class CDVThemeableBrowserViewController; 64 | 65 | @interface CDVThemeableBrowser : CDVPlugin { 66 | BOOL _injectedIframeBridge; 67 | } 68 | 69 | @property (nonatomic, retain) CDVThemeableBrowserViewController* themeableBrowserViewController; 70 | @property (nonatomic, copy) NSString* callbackId; 71 | @property (nonatomic, copy) NSRegularExpression *callbackIdPattern; 72 | 73 | - (CDVThemeableBrowserOptions*)parseOptions:(NSString*)options; 74 | - (void)open:(CDVInvokedUrlCommand*)command; 75 | - (void)close:(CDVInvokedUrlCommand*)command; 76 | - (void)injectScriptCode:(CDVInvokedUrlCommand*)command; 77 | - (void)show:(CDVInvokedUrlCommand*)command; 78 | - (void)show:(CDVInvokedUrlCommand*)command withAnimation:(BOOL)animated; 79 | - (void)reload:(CDVInvokedUrlCommand*)command; 80 | 81 | @end 82 | 83 | @interface CDVThemeableBrowserViewController : UIViewController { 84 | @private 85 | NSString* _userAgent; 86 | NSString* _prevUserAgent; 87 | NSInteger _userAgentLockToken; 88 | UIStatusBarStyle _statusBarStyle; 89 | CDVThemeableBrowserOptions *_browserOptions; 90 | 91 | #ifdef __CORDOVA_4_0_0 92 | CDVUIWebViewDelegate* _webViewDelegate; 93 | #else 94 | CDVWebViewDelegate* _webViewDelegate; 95 | #endif 96 | 97 | } 98 | 99 | @property (nonatomic, strong) IBOutlet UIWebView* webView; 100 | @property (nonatomic, strong) IBOutlet UIButton* closeButton; 101 | @property (nonatomic, strong) IBOutlet UILabel* addressLabel; 102 | @property (nonatomic, strong) IBOutlet UILabel* titleLabel; 103 | @property (nonatomic, strong) IBOutlet UIButton* backButton; 104 | @property (nonatomic, strong) IBOutlet UIButton* forwardButton; 105 | @property (nonatomic, strong) IBOutlet UIButton* menuButton; 106 | @property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner; 107 | @property (nonatomic, strong) IBOutlet UIView* toolbar; 108 | 109 | @property (nonatomic, strong) NSArray* leftButtons; 110 | @property (nonatomic, strong) NSArray* rightButtons; 111 | 112 | @property (nonatomic, weak) id orientationDelegate; 113 | @property (nonatomic, weak) CDVThemeableBrowser* navigationDelegate; 114 | @property (nonatomic) NSURL* currentURL; 115 | @property (nonatomic) CGFloat titleOffset; 116 | 117 | - (void)close; 118 | - (void)reload; 119 | - (void)navigateTo:(NSURL*)url; 120 | - (void)showLocationBar:(BOOL)show; 121 | - (void)showToolBar:(BOOL)show : (NSString*) toolbarPosition; 122 | - (void)setCloseButtonTitle:(NSString*)title; 123 | 124 | - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVThemeableBrowserOptions*) browserOptions navigationDelete:(CDVThemeableBrowser*) navigationDelegate statusBarStyle:(UIStatusBarStyle) statusBarStyle; 125 | 126 | + (UIColor *)colorFromRGBA:(NSString *)rgba; 127 | 128 | @end 129 | 130 | @interface CDVThemeableBrowserNavigationController : UINavigationController 131 | 132 | @property (nonatomic, weak) id orientationDelegate; 133 | 134 | @end 135 | 136 | -------------------------------------------------------------------------------- /src/ios/Resources/README.md: -------------------------------------------------------------------------------- 1 | Files here are for sample during dev purposes only. They are not actually imported to user's project as part of this plugin. -------------------------------------------------------------------------------- /src/ios/Resources/back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/back@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/back_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/back_pressed@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/close@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/close_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/close_pressed@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/forward@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/forward@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/forward_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/forward_pressed@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/menu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/menu@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/menu_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/menu_pressed@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/share@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/share@2x.png -------------------------------------------------------------------------------- /src/ios/Resources/share_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ios/Resources/share_pressed@2x.png -------------------------------------------------------------------------------- /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/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 | oxide.addMessageHandler("EXECUTE", function(msg) { 23 | var code = msg.args.code; 24 | try { 25 | msg.reply({result: eval(code)}); 26 | } catch(e) { 27 | msg.error("Code threw exception: \"" + e + "\""); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /src/ubuntu/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/src/ubuntu/close.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/windows/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 | 26 | 27 | var cordova = require('cordova'), 28 | channel = require('cordova/channel'), 29 | urlutil = require('cordova/urlutil'); 30 | 31 | var browserWrap, 32 | popup, 33 | navigationButtonsDiv, 34 | navigationButtonsDivInner, 35 | backButton, 36 | forwardButton, 37 | closeButton, 38 | bodyOverflowStyle; 39 | 40 | // x-ms-webview is available starting from Windows 8.1 (platformId is 'windows') 41 | // http://msdn.microsoft.com/en-us/library/windows/apps/dn301831.aspx 42 | var isWebViewAvailable = cordova.platformId == 'windows'; 43 | 44 | function attachNavigationEvents(element, callback) { 45 | if (isWebViewAvailable) { 46 | element.addEventListener("MSWebViewNavigationStarting", function (e) { 47 | callback({ type: "loadstart", url: e.uri}, {keepCallback: true} ); 48 | }); 49 | 50 | element.addEventListener("MSWebViewNavigationCompleted", function (e) { 51 | callback({ type: e.isSuccess ? "loadstop" : "loaderror", url: e.uri}, {keepCallback: true}); 52 | }); 53 | 54 | element.addEventListener("MSWebViewUnviewableContentIdentified", function (e) { 55 | // WebView found the content to be not HTML. 56 | // http://msdn.microsoft.com/en-us/library/windows/apps/dn609716.aspx 57 | callback({ type: "loaderror", url: e.uri}, {keepCallback: true}); 58 | }); 59 | 60 | element.addEventListener("MSWebViewContentLoading", function (e) { 61 | if (navigationButtonsDiv) { 62 | backButton.disabled = !popup.canGoBack; 63 | forwardButton.disabled = !popup.canGoForward; 64 | } 65 | }); 66 | } else { 67 | var onError = function () { 68 | callback({ type: "loaderror", url: this.contentWindow.location}, {keepCallback: true}); 69 | }; 70 | 71 | element.addEventListener("unload", function () { 72 | callback({ type: "loadstart", url: this.contentWindow.location}, {keepCallback: true}); 73 | }); 74 | 75 | element.addEventListener("load", function () { 76 | callback({ type: "loadstop", url: this.contentWindow.location}, {keepCallback: true}); 77 | }); 78 | 79 | element.addEventListener("error", onError); 80 | element.addEventListener("abort", onError); 81 | } 82 | } 83 | 84 | var IAB = { 85 | close: function (win, lose) { 86 | if (browserWrap) { 87 | if (win) win({ type: "exit" }); 88 | 89 | browserWrap.parentNode.removeChild(browserWrap); 90 | // Reset body overflow style to initial value 91 | document.body.style.msOverflowStyle = bodyOverflowStyle; 92 | browserWrap = null; 93 | popup = null; 94 | } 95 | }, 96 | show: function (win, lose) { 97 | if (browserWrap) { 98 | browserWrap.style.display = "block"; 99 | } 100 | }, 101 | open: function (win, lose, args) { 102 | var strUrl = args[0], 103 | target = args[1], 104 | features = args[2], 105 | url; 106 | 107 | if (target === "_system") { 108 | url = new Windows.Foundation.Uri(strUrl); 109 | Windows.System.Launcher.launchUriAsync(url); 110 | } else if (target === "_self" || !target) { 111 | window.location = strUrl; 112 | } else { 113 | // "_blank" or anything else 114 | if (!browserWrap) { 115 | var browserWrapStyle = document.createElement('link'); 116 | browserWrapStyle.rel = "stylesheet"; 117 | browserWrapStyle.type = "text/css"; 118 | browserWrapStyle.href = urlutil.makeAbsolute("/www/css/inappbrowser.css"); 119 | 120 | document.head.appendChild(browserWrapStyle); 121 | 122 | browserWrap = document.createElement("div"); 123 | browserWrap.className = "inAppBrowserWrap"; 124 | 125 | if (features.indexOf("fullscreen=yes") > -1) { 126 | browserWrap.classList.add("inAppBrowserWrapFullscreen"); 127 | } 128 | 129 | // Save body overflow style to be able to reset it back later 130 | bodyOverflowStyle = document.body.style.msOverflowStyle; 131 | 132 | browserWrap.onclick = function () { 133 | setTimeout(function () { 134 | IAB.close(win); 135 | }, 0); 136 | }; 137 | 138 | document.body.appendChild(browserWrap); 139 | // Hide scrollbars for the whole body while inappbrowser's window is open 140 | document.body.style.msOverflowStyle = "none"; 141 | } 142 | 143 | if (features.indexOf("hidden=yes") !== -1) { 144 | browserWrap.style.display = "none"; 145 | } 146 | 147 | popup = document.createElement(isWebViewAvailable ? "x-ms-webview" : "iframe"); 148 | if (popup instanceof HTMLIFrameElement) { 149 | // For iframe we need to override bacground color of parent element here 150 | // otherwise pages without background color set will have transparent background 151 | popup.style.backgroundColor = "white"; 152 | } 153 | popup.style.borderWidth = "0px"; 154 | popup.style.width = "100%"; 155 | 156 | browserWrap.appendChild(popup); 157 | 158 | if (features.indexOf("location=yes") !== -1 || features.indexOf("location") === -1) { 159 | popup.style.height = "calc(100% - 60px)"; 160 | 161 | navigationButtonsDiv = document.createElement("div"); 162 | navigationButtonsDiv.style.height = "60px"; 163 | navigationButtonsDiv.style.backgroundColor = "#404040"; 164 | navigationButtonsDiv.style.zIndex = "999"; 165 | navigationButtonsDiv.onclick = function (e) { 166 | e.cancelBubble = true; 167 | }; 168 | 169 | navigationButtonsDivInner = document.createElement("div"); 170 | navigationButtonsDivInner.style.paddingTop = "10px"; 171 | navigationButtonsDivInner.style.height = "50px"; 172 | navigationButtonsDivInner.style.width = "160px"; 173 | navigationButtonsDivInner.style.margin = "0 auto"; 174 | navigationButtonsDivInner.style.backgroundColor = "#404040"; 175 | navigationButtonsDivInner.style.zIndex = "999"; 176 | navigationButtonsDivInner.onclick = function (e) { 177 | e.cancelBubble = true; 178 | }; 179 | 180 | 181 | backButton = document.createElement("button"); 182 | backButton.style.width = "40px"; 183 | backButton.style.height = "40px"; 184 | backButton.style.borderRadius = "40px"; 185 | 186 | backButton.innerText = "<-"; 187 | backButton.addEventListener("click", function (e) { 188 | if (popup.canGoBack) 189 | popup.goBack(); 190 | }); 191 | 192 | forwardButton = document.createElement("button"); 193 | forwardButton.style.marginLeft = "20px"; 194 | forwardButton.style.width = "40px"; 195 | forwardButton.style.height = "40px"; 196 | forwardButton.style.borderRadius = "40px"; 197 | 198 | forwardButton.innerText = "->"; 199 | forwardButton.addEventListener("click", function (e) { 200 | if (popup.canGoForward) 201 | popup.goForward(); 202 | }); 203 | 204 | closeButton = document.createElement("button"); 205 | closeButton.style.marginLeft = "20px"; 206 | closeButton.style.width = "40px"; 207 | closeButton.style.height = "40px"; 208 | closeButton.style.borderRadius = "40px"; 209 | 210 | closeButton.innerText = "x"; 211 | closeButton.addEventListener("click", function (e) { 212 | setTimeout(function () { 213 | IAB.close(win); 214 | }, 0); 215 | }); 216 | 217 | if (!isWebViewAvailable) { 218 | // iframe navigation is not yet supported 219 | backButton.disabled = true; 220 | forwardButton.disabled = true; 221 | } 222 | 223 | navigationButtonsDivInner.appendChild(backButton); 224 | navigationButtonsDivInner.appendChild(forwardButton); 225 | navigationButtonsDivInner.appendChild(closeButton); 226 | navigationButtonsDiv.appendChild(navigationButtonsDivInner); 227 | 228 | browserWrap.appendChild(navigationButtonsDiv); 229 | } else { 230 | popup.style.height = "100%"; 231 | } 232 | 233 | // start listening for navigation events 234 | attachNavigationEvents(popup, win); 235 | 236 | if (isWebViewAvailable) { 237 | strUrl = strUrl.replace("ms-appx://", "ms-appx-web://"); 238 | } 239 | popup.src = strUrl; 240 | } 241 | }, 242 | 243 | injectScriptCode: function (win, fail, args) { 244 | var code = args[0], 245 | hasCallback = args[1]; 246 | 247 | if (isWebViewAvailable && browserWrap && popup) { 248 | var op = popup.invokeScriptAsync("eval", code); 249 | op.oncomplete = function (e) { 250 | var result = [e.target.result]; 251 | hasCallback && win(result); 252 | }; 253 | op.onerror = function () { }; 254 | op.start(); 255 | } 256 | }, 257 | 258 | injectScriptFile: function (win, fail, args) { 259 | var filePath = args[0], 260 | hasCallback = args[1]; 261 | 262 | if (!!filePath) { 263 | filePath = urlutil.makeAbsolute(filePath); 264 | } 265 | 266 | if (isWebViewAvailable && browserWrap && popup) { 267 | var uri = new Windows.Foundation.Uri(filePath); 268 | Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) { 269 | Windows.Storage.FileIO.readTextAsync(file).done(function (code) { 270 | var op = popup.invokeScriptAsync("eval", code); 271 | op.oncomplete = function(e) { 272 | var result = [e.target.result]; 273 | hasCallback && win(result); 274 | }; 275 | op.onerror = function () { }; 276 | op.start(); 277 | }); 278 | }); 279 | } 280 | }, 281 | 282 | injectStyleCode: function (win, fail, args) { 283 | var code = args[0], 284 | hasCallback = args[1]; 285 | 286 | if (isWebViewAvailable && browserWrap && popup) { 287 | injectCSS(popup, code, hasCallback && win); 288 | } 289 | }, 290 | 291 | injectStyleFile: function (win, fail, args) { 292 | var filePath = args[0], 293 | hasCallback = args[1]; 294 | 295 | filePath = filePath && urlutil.makeAbsolute(filePath); 296 | 297 | if (isWebViewAvailable && browserWrap && popup) { 298 | var uri = new Windows.Foundation.Uri(filePath); 299 | Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(function (file) { 300 | return Windows.Storage.FileIO.readTextAsync(file); 301 | }).done(function (code) { 302 | injectCSS(popup, code, hasCallback && win); 303 | }, function () { 304 | // no-op, just catch an error 305 | }); 306 | } 307 | } 308 | }; 309 | 310 | function injectCSS (webView, cssCode, callback) { 311 | // This will automatically escape all thing that we need (quotes, slashes, etc.) 312 | var escapedCode = JSON.stringify(cssCode); 313 | var evalWrapper = "(function(d){var c=d.createElement('style');c.innerHTML=%s;d.head.appendChild(c);})(document)" 314 | .replace('%s', escapedCode); 315 | 316 | var op = webView.invokeScriptAsync("eval", evalWrapper); 317 | op.oncomplete = function() { 318 | callback && callback([]); 319 | }; 320 | op.onerror = function () { }; 321 | op.start(); 322 | } 323 | 324 | module.exports = IAB; 325 | 326 | require("cordova/exec/proxy").add("InAppBrowser", module.exports); 327 | -------------------------------------------------------------------------------- /tests/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | Cordova ThemeableBrowser Plugin Tests 25 | Apache 2.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /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.html: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Cordova Mobile Spec 29 | 30 | 31 | 32 |

ThemeableBrowser - Script / Style Injection Test

33 | 34 | 35 |
User-Agent:
36 | 37 | 44 | 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 themeableBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.
50 |
51 |
Visit Google (whitelisted)
52 |
Visit Yahoo (not whitelisted)
53 | 54 | 55 |

Back 56 |

57 | 58 |

tall div with border
59 | 60 | 67 | 68 | -------------------------------------------------------------------------------- /tests/resources/local.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/initialxy/cordova-plugin-themeablebrowser/eb20df43b6937d74ed86aea7af31ec11ddcfbaa7/tests/resources/local.pdf -------------------------------------------------------------------------------- /tests/resources/video.html: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Cordova Mobile Spec 29 | 30 | 31 | 32 | 37 |
38 | 39 | 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /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 | border: 0; 24 | outline: 0; 25 | font-size: 100%; 26 | vertical-align: baseline; 27 | background: 0 0; 28 | position: fixed; 29 | top: 0; 30 | left: 0; 31 | width: calc(100% - 80px); 32 | height: calc(100% - 80px); 33 | z-index: 9999999; 34 | border: 40px solid #bfbfbf; 35 | border: 40px solid rgba(0, 0, 0, 0.25); 36 | } 37 | 38 | .inAppBrowserWrapFullscreen { 39 | width: 100%; 40 | height: 100%; 41 | border: 0; 42 | } 43 | -------------------------------------------------------------------------------- /www/themeablebrowser.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 exec = require('cordova/exec'); 23 | var channel = require('cordova/channel'); 24 | var modulemapper = require('cordova/modulemapper'); 25 | var urlutil = require('cordova/urlutil'); 26 | 27 | function ThemeableBrowser() { 28 | this.channels = {}; 29 | } 30 | 31 | ThemeableBrowser.prototype = { 32 | _eventHandler: function (event) { 33 | if (event && (event.type in this.channels)) { 34 | this.channels[event.type].fire(event); 35 | } 36 | }, 37 | close: function (eventname) { 38 | exec(null, null, 'ThemeableBrowser', 'close', []); 39 | return this; 40 | }, 41 | show: function (eventname) { 42 | exec(null, null, 'ThemeableBrowser', 'show', []); 43 | return this; 44 | }, 45 | reload: function (eventname) { 46 | exec(null, null, 'ThemeableBrowser', 'reload', []); 47 | return this; 48 | }, 49 | addEventListener: function (eventname,f) { 50 | if (!(eventname in this.channels)) { 51 | this.channels[eventname] = channel.create(eventname); 52 | } 53 | this.channels[eventname].subscribe(f); 54 | return this; 55 | }, 56 | removeEventListener: function(eventname, f) { 57 | if (eventname in this.channels) { 58 | this.channels[eventname].unsubscribe(f); 59 | } 60 | return this; 61 | }, 62 | 63 | executeScript: function(injectDetails, cb) { 64 | if (injectDetails.code) { 65 | exec(cb, null, 'ThemeableBrowser', 'injectScriptCode', [injectDetails.code, !!cb]); 66 | } else if (injectDetails.file) { 67 | exec(cb, null, 'ThemeableBrowser', 'injectScriptFile', [injectDetails.file, !!cb]); 68 | } else { 69 | throw new Error('executeScript requires exactly one of code or file to be specified'); 70 | } 71 | return this; 72 | }, 73 | 74 | insertCSS: function(injectDetails, cb) { 75 | if (injectDetails.code) { 76 | exec(cb, null, 'ThemeableBrowser', 'injectStyleCode', [injectDetails.code, !!cb]); 77 | } else if (injectDetails.file) { 78 | exec(cb, null, 'ThemeableBrowser', 'injectStyleFile', [injectDetails.file, !!cb]); 79 | } else { 80 | throw new Error('insertCSS requires exactly one of code or file to be specified'); 81 | } 82 | return this; 83 | } 84 | }; 85 | 86 | exports.open = function(strUrl, strWindowName, strWindowFeatures, callbacks) { 87 | // Don't catch calls that write to existing frames (e.g. named iframes). 88 | if (window.frames && window.frames[strWindowName]) { 89 | var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open'); 90 | return origOpenFunc.apply(window, arguments); 91 | } 92 | 93 | strUrl = urlutil.makeAbsolute(strUrl); 94 | var iab = new ThemeableBrowser(); 95 | 96 | callbacks = callbacks || {}; 97 | for (var callbackName in callbacks) { 98 | iab.addEventListener(callbackName, callbacks[callbackName]); 99 | } 100 | 101 | var cb = function(eventname) { 102 | iab._eventHandler(eventname); 103 | }; 104 | 105 | strWindowFeatures = strWindowFeatures && JSON.stringify(strWindowFeatures); 106 | // Slightly delay the actual native call to give the user a chance to 107 | // register event listeners first, otherwise some warnings or errors may be missed. 108 | setTimeout(function() { 109 | exec(cb, cb, 'ThemeableBrowser', 'open', [strUrl, strWindowName, strWindowFeatures || '']); 110 | }, 0); 111 | return iab; 112 | }; 113 | 114 | exports.EVT_ERR = 'ThemeableBrowserError'; 115 | exports.EVT_WRN = 'ThemeableBrowserWarning'; 116 | exports.ERR_CRITICAL = 'critical'; 117 | exports.ERR_LOADFAIL = 'loadfail'; 118 | exports.WRN_UNEXPECTED = 'unexpected'; 119 | exports.WRN_UNDEFINED = 'undefined'; -------------------------------------------------------------------------------- /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 | 26 | 27 | var cordova = require('cordova'), 28 | channel = require('cordova/channel'); 29 | 30 | var browserWrap; 31 | 32 | var IAB = { 33 | 34 | close: function (win, lose) { 35 | if (browserWrap) { 36 | browserWrap.parentNode.removeChild(browserWrap); 37 | browserWrap = null; 38 | } 39 | }, 40 | show: function (win, lose) { 41 | /* empty block, ran out of bacon? 42 | if (browserWrap) { 43 | 44 | }*/ 45 | }, 46 | open: function (win, lose, args) { 47 | var strUrl = args[0], 48 | target = args[1], 49 | features = args[2], 50 | url, 51 | elem; 52 | 53 | if (target === "_system") { 54 | url = new Windows.Foundation.Uri(strUrl); 55 | Windows.System.Launcher.launchUriAsync(url); 56 | } else if (target === "_blank") { 57 | if (!browserWrap) { 58 | browserWrap = document.createElement("div"); 59 | browserWrap.style.position = "absolute"; 60 | browserWrap.style.width = (window.innerWidth - 80) + "px"; 61 | browserWrap.style.height = (window.innerHeight - 80) + "px"; 62 | browserWrap.style.borderWidth = "40px"; 63 | browserWrap.style.borderStyle = "solid"; 64 | browserWrap.style.borderColor = "rgba(0,0,0,0.25)"; 65 | 66 | browserWrap.onclick = function () { 67 | setTimeout(function () { 68 | IAB.close(); 69 | }, 0); 70 | }; 71 | 72 | document.body.appendChild(browserWrap); 73 | } 74 | 75 | elem = document.createElement("iframe"); 76 | elem.style.width = (window.innerWidth - 80) + "px"; 77 | elem.style.height = (window.innerHeight - 80) + "px"; 78 | elem.style.borderWidth = "0px"; 79 | elem.name = "targetFrame"; 80 | elem.src = strUrl; 81 | 82 | window.addEventListener("resize", function () { 83 | if (browserWrap && elem) { 84 | elem.style.width = (window.innerWidth - 80) + "px"; 85 | elem.style.height = (window.innerHeight - 80) + "px"; 86 | } 87 | }); 88 | 89 | browserWrap.appendChild(elem); 90 | } else { 91 | window.location = strUrl; 92 | } 93 | 94 | //var object = new WinJS.UI.HtmlControl(elem, { uri: strUrl }); 95 | 96 | }, 97 | 98 | injectScriptCode: function (code, bCB) { 99 | 100 | // "(function(d) { var c = d.createElement('script'); c.src = %@; d.body.appendChild(c); })(document)" 101 | }, 102 | 103 | injectScriptFile: function (file, bCB) { 104 | 105 | } 106 | }; 107 | 108 | module.exports = IAB; 109 | 110 | 111 | require("cordova/exec/proxy").add("InAppBrowser", module.exports); 112 | --------------------------------------------------------------------------------