Invoke webview if using local file

This commit is contained in:
aroberson 2015-04-13 15:33:03 -05:00
parent 11a2acfd7b
commit 8175122c03

View File

@ -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);
}
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;
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";
}
});
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 {