I want to programmatically change cordova inAppBrowser's url when user clicked a notification. I have searched but nothing found. i have tried:
var theurl,newurl,ref;
theurl = 'http://example1.com';
newurl = 'http://example2.com';
function a(){
ref = window.open(theurl, '_blank', 'location=no,hidden=yes,toolbar=no,EnableViewPortScale=yes,zoom=no');
}
function b(){
ref.location.href = newurl;
}
i also tried this:
function b(){
ref.url = newurl;
}
But, it seems like not working, is there any code?
Finally i've found the solution. I am using executeScript method to change the url via javascript. here is what i do:
function b(){
ref.executeScript({
code: "window.location = '"+newurl+"';"
}, function() {
//alert("Redirected!");
});
}