I am programming my first app and using Phonegap Build 3.7 most of my app is hosted in a php server and i use Inappbrowser as a UI. My question is i have some googleads that i want to open in a new window when clicked and not the same webview inside Inappbrowser, i know that you can use "_system" while still "inside the app" but as soon as Inappbrowser is launched acts as a standalone browser. Is it possible to inject a javascript i.e. "phonegap.js" from you local file and use window.open('blabla' '_system') to correct this issue? Many thanks in advance, i hope i made myself clear as i am just starting. BTW does anyone know the exact location of the "phonegap.js" or "cordova.js" in Android or IOS apps?
0
votes
1 Answers
3
votes
Cordova Inappbrowser provides executeScript() to inject javascript to external page after the load get finished.
// Global InAppBrowser reference
var iabRef = null;
function InjectScript() {
iabRef.executeScript({
code: " /* Your code here */ "
}, function() {
alert("Code added");
});
}
iabRef = window.open('http://google.com', '_blank', 'location=yes');
iabRef.addEventListener('loadstop', InjectScript);