phonegap events supported for _blank target

This commit is contained in:
Tracktl 2014-08-05 15:50:49 +02:00
parent 8cb876c63a
commit c2c94f315b

View File

@ -34,6 +34,7 @@ var IABExecs = {
if (browserWrap) { if (browserWrap) {
browserWrap.parentNode.removeChild(browserWrap); browserWrap.parentNode.removeChild(browserWrap);
browserWrap = null; browserWrap = null;
if (typeof(win) == "function") win({type:'exit'});
} }
}, },
@ -135,7 +136,7 @@ var IABExecs = {
close.addEventListener('click', function () { close.addEventListener('click', function () {
setTimeout(function () { setTimeout(function () {
IABExecs.close(); IABExecs.close(win, lose);
}, 0); }, 0);
}, false); }, false);
@ -154,6 +155,23 @@ var IABExecs = {
browserWrap.appendChild(menu); browserWrap.appendChild(menu);
browserWrap.appendChild(browserElem); browserWrap.appendChild(browserElem);
document.body.appendChild(browserWrap); document.body.appendChild(browserWrap);
//we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url
browserElem.addEventListener('mozbrowserlocationchange', function(e){
win({
type:'loadstart',
url : e.detail
})
}, false);
browserElem.addEventListener('mozbrowserloadend', function(e){
win({type:'loadstop'})
}, false);
browserElem.addEventListener('mozbrowsererror', function(e){
win({type:'loaderror'})
}, false);
browserElem.addEventListener('mozbrowserclose', function(e){
win({type:'exit'})
}, false);
} else { } else {
window.location = strUrl; window.location = strUrl;
} }