I am working in a Cordova project under different platforms, for example iOS and Windows 8 tablet, this app works has support in browsers like IE11 or Chrome, but I am having problems with the implementation with the InAppBrowser plugin, under W8 tablet doesn´t work and if you do "tap" in different buttons to open attachments, this event doesn´t work... What is the problem??!
I have a class to manage this with the next code...
openLinkInNewWindow: function (url) {
var link = Ext.getDom(this.getLinkId()),
clickevent = document.createEvent('Event'),
hash = location.hash;
if (Ext.browser.is.Standalone) {
localStorage.setItem('lastVisitRouteForLunchApp', hash);
}
if (Ext.os.deviceType == "Tablet" && Ext.os.name == "Windows") {
window.open(url, '_blank', 'location=yes');
}
if (Ext.os.deviceType == "Tablet" && Ext.os.name == "iOS") {
window.open(url, '_blank', 'location=yes');
} else {
link.href = url;
Ext.Function.defer(function () {
clickevent.initEvent('click', true, false);
link.dispatchEvent(clickevent);
}, 500);
}
}
What am I doing wrong? (code is based in Sencha Touch Framework)
I found the solution with the next code added in the index.html
function isPhoneGap() {
if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) {
return true;
} else {
return false;
}
}
function openPage(link) {
if (isPhoneGap() == true) {
var ref = window.open(link.href, '_blank', 'location=yes,enableViewPortScale=yes');
return false;
} else {
return true;
}
}
And now it is working correctly and I am so happy!!! :-)