Invoke webview if using local file

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/8175122c
Tree: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/8175122c
Diff: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/8175122c

Branch: refs/heads/master
Commit: 8175122c038773f6119e6da590c69746517b4f68
Parents: 11a2acf
Author: aroberson <[email protected]>
Authored: Mon Apr 13 15:33:03 2015 -0500
Committer: aroberson <[email protected]>
Committed: Mon Apr 13 15:33:03 2015 -0500

----------------------------------------------------------------------
 www/windows8/InAppBrowserProxy.js | 53 ++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/8175122c/www/windows8/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/www/windows8/InAppBrowserProxy.js 
b/www/windows8/InAppBrowserProxy.js
index 34cc902..42d15d2 100644
--- a/www/windows8/InAppBrowserProxy.js
+++ b/www/windows8/InAppBrowserProxy.js
@@ -17,13 +17,12 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 /*jslint sloppy:true */
 /*global Windows:true, require, document, setTimeout, window, module */
 
 
-
 var cordova = require('cordova'),
     channel = require('cordova/channel');
 
@@ -39,9 +38,9 @@ var IAB = {
     },
     show: function (win, lose) {
         /* empty block, ran out of bacon?
-        if (browserWrap) {
+         if (browserWrap) {
 
-        }*/
+         }*/
     },
     open: function (win, lose, args) {
         var strUrl = args[0],
@@ -72,20 +71,38 @@ var IAB = {
 
                 document.body.appendChild(browserWrap);
             }
-
-            elem = document.createElement("iframe");
-            elem.style.width = (window.innerWidth - 80) + "px";
-            elem.style.height = (window.innerHeight - 80) + "px";
-            elem.style.borderWidth = "0px";
-            elem.name = "targetFrame";
-            elem.src = strUrl;
-
-            window.addEventListener("resize", function () {
-                if (browserWrap && elem) {
-                    elem.style.width = (window.innerWidth - 80) + "px";
-                    elem.style.height = (window.innerHeight - 80) + "px";
-                }
-            });
+            var localFile = (strUrl.indexOf('ms-appdata:///') > -1);
+            if (localFile) {
+                elem = document.createElement("x-ms-webview");
+                elem.style.width = (window.innerWidth - 80) + "px";
+                elem.style.height = (window.innerHeight - 80) + "px";
+                elem.style.borderWidth = "0px";
+                elem.name = "targetFrame";
+                elem.src = strUrl;
+
+                window.addEventListener("resize", function () {
+                    if (browserWrap && elem) {
+                        elem.style.width = (window.innerWidth - 80) + "px";
+                        elem.style.height = (window.innerHeight - 80) + "px";
+                    }
+                });
+
+            } else {
+                elem = document.createElement("iframe");
+                elem.style.width = (window.innerWidth - 80) + "px";
+                elem.style.height = (window.innerHeight - 80) + "px";
+                elem.style.borderWidth = "0px";
+                elem.name = "targetFrame";
+                elem.src = strUrl;
+
+
+                window.addEventListener("resize", function () {
+                    if (browserWrap && elem) {
+                        elem.style.width = (window.innerWidth - 80) + "px";
+                        elem.style.height = (window.innerHeight - 80) + "px";
+                    }
+                });
+            }
 
             browserWrap.appendChild(elem);
         } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to