apache / apache/cordova-plugin-inappbrowser

In App Browser not working on Android 7.1.4

Open
#397 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

Whenever i call cordova.InAppBrowser.open on in Android, it fails.
It is working on IOS though.
The same code worked on another application, but not now.
I'll add my config.xml for reference.-> [config.xml](https://github.com/apache/cordova-plugin-inappbrowser/files/2749405/config.xml.txt)
Below is my code which happens on a button click event:

`
var urlToShow;
if (btn == "fb")
{
//window.open("https://www.facebook.com/SARugbyLegendsAssociation/", "_blank");
urlToShow = "https://www.facebook.com/SARugbyLegendsAssociation";
}
else if (btn == "twt")
{
//window.open("https://twitter.com/SARugbyLegends", "_blank");
urlToShow = "https://twitter.com/SARugbyLegends";
}

console.log('url to show is ' + urlToShow);
var ref;
console.log('opening url using set timeout');

var callbacks = [];
callbacks['loadstart'] = function ()
{
console.log('loadstart');
}
callbacks['loadstop'] = function ()
{
console.log('loadstop');
}
callbacks['loaderror'] = function (err)
{
console.log('loaderror');
console.log(JSON.stringify(err));
}
callbacks['exit'] = function ()
{
console.log('exit');
}
callbacks['customscheme'] = function ()
{
console.log('on custom scheme');
}

setTimeout(function ()
{
try
{
var optionString = "location=no,toolbar=yes,hardwareback=yes,closebuttoncaption=Done,footer=yes,EnableViewportScale=yes,disallowoverscroll=yes,hidden=no";
if (typeof cordova !== "undefined" && cordova !== null && typeof cordova.InAppBrowser != "undefined" && cordova.InAppBrowser !== null

)
{
console.log('showing URL using inAppBrowser');
ref = cordova.InAppBrowser.open(urlToShow, '_blank', optionString, callbacks);
//cordova.InAppBrowser.open(urlToShow, '_self');
//cordova.InAppBrowser.open(urlToShow, '_system');
//cordova.InAppBrowser.open(urlToShow, '_blank');
//cordova.InAppBrowser.open(urlToShow, 'random_string');
}
else
{
console.log('cordova in app browser not found, using window.open');
ref = window.open(urlToShow, '_blank', optionString, callbacks);
}

console.log('ref = ');
console.log(ref);

console.log('calling show 3');
ref.show();
}
catch (error)
{
console.log('error');
console.log(error);
}
}, 100);`

I've tried a bunch of different things, but when i click the button absolutely nothing happens.
I can see my console.log items being logged but no window opening.
This does work on IOS and it did work in other projects. This should be easy, i don't understand.
I have tried to remove and re-install the plugin many times.

Any help would be much appreciated.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure on Android using the attached config.xml and the cordova.InAppBrowser.open call shown in the report. Inspect the plugin path involving ref.show() and compare the Android result with the reported iOS behavior. The issue is complete when the supplied URLs open on Android and the relevant callbacks behave as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.