InAppBrowser events not firing on Android (Cordova 3.1.0)

8,602 views
Skip to first unread message

tom....@zestia.com

unread,
Oct 9, 2013, 11:36:06 AM10/9/13
to phon...@googlegroups.com
I'm in the process of updating our 3.0.0 projects to 3.1.0, I've updated the InAppBrowser plugin and the "loadXYZ" events are firing and working correctly on iOS, however they're not being fired on Android, even though the InAppBrowser is opening the requested page successfully.

Has anyone encountered this issue with the latest InAppBrowser plugin?

Jake Riesterer

unread,
Oct 14, 2013, 5:41:31 PM10/14/13
to phon...@googlegroups.com
I've also noticed the same issue in our project. Haven't been able to figure out what change broke it quite yet.

rjrj...@gmail.com

unread,
Oct 15, 2013, 12:11:30 AM10/15/13
to phon...@googlegroups.com
I am having the same problem with Android (not tested on iOS -- don't have it yet).  I didn't do an upgrade.  I started clean with Cordova 3.1.0.  The InAppBrowser page is opening, but no events are firing.  I am using the example from:
http://cordova.apache.org/docs/en/3.1.0/cordova_inappbrowser_inappbrowser.md.html#addEventListener

Can someone please help?

Thanks.


On Wednesday, October 9, 2013 10:36:06 AM UTC-5, tom....@zestia.com wrote:

Patrick Stinnett

unread,
Oct 15, 2013, 2:57:33 PM10/15/13
to phon...@googlegroups.com
I'm having the same issue. Just posting to get notified incase someone else finds the issue. 

Matt Null

unread,
Nov 9, 2013, 2:00:43 PM11/9/13
to phon...@googlegroups.com
Also having the same problem. Page loads in the app itself (not a new browser) and doesn't fire any events

Tom Wilson

unread,
Nov 11, 2013, 7:21:53 PM11/11/13
to phon...@googlegroups.com
Was anyone able to fix this issue?  I'm also experiencing this issue.

Here is an entry I am getting from logcat. 

11-11 17:19:04.389: W/CordovaPlugin(14458): Attempted to send a second callback for ID: InAppBrowser1052814497
11-11 17:19:04.389: W/CordovaPlugin(14458): Result was: {"type":"loadstart","url":"https:\/\/xxxxxx.com"}

tom....@zestia.com

unread,
Nov 12, 2013, 7:45:30 AM11/12/13
to phon...@googlegroups.com
Well, I'm still having this issue.

Created a new project to try out the inappbrowser plugin, works fine. However there aren't are differences in the actual Android source between the two projects.

This is getting annoying when each Cordova upgrade breaks my app.

Tom Wilson

unread,
Nov 12, 2013, 11:02:51 AM11/12/13
to phon...@googlegroups.com
I ended up reverting my android project code via version control and backed out my changes.  I then put back in the same javascript/html code so it must have been something with the phonegap settings.  I looked through the android source code for the inappbrowser and it looked like it was using different callback functions for sending back return results to javascript. Does this need to be updated?

Has anyone used the childbrowser plugin?
Does this have better android support?

I'm using InAppBrowser to handle SSO login so there are alot of redirects, ect.  Not sure if this could be causing the issue.

Thanks for your help!

Tom

Shawn Talbert

unread,
Nov 17, 2013, 2:45:23 PM11/17/13
to phon...@googlegroups.com
I've having the same issues and trying to do reliable openauth login with google.

Alternately, Is there some SSO plugin for phonegap/cordova that works?

Tom, did you ever get this resolved? I'm not clear with your statement below - does your callback now get called? If so, which combination of android version and phonegap version is working with InAppBrowser?

Tom Wilson

unread,
Nov 25, 2013, 10:38:01 AM11/25/13
to phon...@googlegroups.com
From this blog post it looks like callbacks are broken when you target kitkat.
Upgrading to 3.1 fixed my issue.


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/e5_5unC2fYs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Tom Wilson
Alpine Metrics Lead UI Developer

203 Enterprise Blvd, STE 3
Bozeman, MT 59718

Alex Lopez

unread,
Dec 6, 2013, 1:20:26 AM12/6/13
to phon...@googlegroups.com
I have just installed cordova 3.1.0-0.2.0 and InAppBrowser seems not to be working, all my links with _blank and _system open in the same window, happening on Android Kitkat and iOS7, any ideass or links to the solution?

David Urbansky

unread,
Dec 9, 2013, 5:14:21 PM12/9/13
to phon...@googlegroups.com
Hi, I have the same issue, using cordova 3.2.0, no events are firing, sometimes the first "loadstart" event fires but not the ones after that and I use it for SSO as well so I need the redirects.

If anybody has figured this out, I would appreciate a line here.

Thanks,
         David

Faisal Siddiqi

unread,
Dec 11, 2013, 12:07:16 PM12/11/13
to phon...@googlegroups.com, davidu...@gmail.com
I face the same issue on iOS.  window.open with _blank overlays the main window with no "Done" button or other controls visible

Any help would be much appreciated.

Thanks

Faisal

Jake Monton

unread,
Dec 19, 2013, 12:28:23 AM12/19/13
to phon...@googlegroups.com
I got the same issue on PhoneGap 3.3. Anyone who knows how to fix this?

Thanks

Billy Shea

unread,
Jan 9, 2014, 1:32:19 AM1/9/14
to phon...@googlegroups.com
same here, cordova 3.3 target android KitKat, no event fires, no done button, no toolbar, need help!

Anthony Trimble

unread,
Feb 10, 2014, 12:19:03 PM2/10/14
to phon...@googlegroups.com
Does anyone know of a fix? 

Sames issue still persists in 3.3

Thomas Strmiska

unread,
Feb 11, 2014, 10:40:20 AM2/11/14
to phon...@googlegroups.com
also tested in phonegap 3.3 ios - xcode 5; no inAppBrowser is starting.
does anyone know of this issue?
thanx

Rob Whiteside

unread,
Feb 14, 2014, 3:27:13 PM2/14/14
to phon...@googlegroups.com
For any people still having problems.  I was hitting a problem where the InAppBrowser was showing up, but no events were firing.  It turned out my function signature was incorrect.  Looking at the phonegap 3.3 docs for InAppBrowser, there are several inconsistencies, which caused my problem.  Anyway, verify that you are adding your event listeners properly.  See below:

ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
ref.addEventListener('exit', function(event) { alert(event.type); });


Notice that the method signature contains one variable: event.  If you leave that off (as many of the examples in the official docs do) your listeners won't get called.

Hope that helps someone out there!
--Rob

Red2678

unread,
Mar 19, 2014, 10:09:50 PM3/19/14
to phon...@googlegroups.com
Any ideas?

The loadstart and loadstop events do not fire in iOS 7.1.

Thanks!

Joaquin Rocco

unread,
Mar 21, 2014, 10:14:06 AM3/21/14
to phon...@googlegroups.com
After two days, I actually got it working:

- install latest cordova (3.4)
- create new project from cli
- create the platform

Now you have the default project, I just put the call for the browser in the index.js (onDeviceReady)

var ref = window.open('http://www.google.com', '_blank');
ref.addEventListener('loadstart', function(event) { alert(event.type + ' - ' + event.url); } );

The latest version of the InAppBrowser failed on previous versions of cordova, as well as previos versions of the plugin in older cordovas.

A clean install got it to work.

Still, i haven't tested it yet on ios7.
Hope it helps, cheers!

tome...@gmail.com

unread,
Mar 24, 2014, 4:41:21 AM3/24/14
to phon...@googlegroups.com
hi.
i am also tryed tons of times to use, and those event just dont fire!
does anybody have any working solotion for this?
i need to use the events for google login in my app..
thanks

Message has been deleted

nukturnal

unread,
May 5, 2014, 3:29:55 AM5/5/14
to phon...@googlegroups.com
Events Firing Finally.

After several days I just got it to work. Apparently the events dont fire when location is set to no.

This wont fire events
var ref = window.open('https://google.com','_blank','location=no');

This works (notice location is set to yes)
var ref = window.open('https://google.com','_blank','location=yes');

Lets know if this works for you guys (I am using Cordova 3.4.0)

Cheers!

Remco Mokveld

unread,
May 6, 2014, 6:47:57 AM5/6/14
to phon...@googlegroups.com
Does not seem to work for me.
As a matter of fact while using cordova 3.4.1-0.1.0 in combination with inappbrowser 0.4.0 i have the strangest thing happening. If i add a loadstop and execute the following script it will not fire the load stop event until i turn off my screen and turn it back on. Any idea how that could happen?

var ref = window.open( 'http://apache.org', "_blank", "location=yes" );

  ref.addEventListener( 'loadstop', function () {

    ref.close();

  })


julija....@privatbank.ua

unread,
May 8, 2014, 8:14:36 AM5/8/14
to phon...@googlegroups.com

There are 2 different ways to open URL in android and iphone.

FOR IOS use following code.

window.open("http://google.com", '_system');

and for android OS use following code.

navigator.app.loadUrl("http://google.com", {openExternal : true});

I found answer here: http://stackoverflow.com/questions/17887348/phonegap-open-link-in-browser

среда, 9 октября 2013 г., 18:36:06 UTC+3 пользователь tom....@zestia.com написал:

hit...@appsnranks.com

unread,
Aug 7, 2014, 3:53:03 AM8/7/14
to phon...@googlegroups.com
Hey Tom,

How are you??

Can you please let me know the code to add DONE button in inappbrowser for phonegap iphone application ???

I eagerly waiting for your reply..

Steve Husting

unread,
Aug 8, 2014, 11:35:09 AM8/8/14
to phon...@googlegroups.com

Michael Read

unread,
Sep 20, 2014, 5:03:12 PM9/20/14
to phon...@googlegroups.com
Found a solution, I was having the same problem this was the first thing to pop up in google

make sure that InAppBrowser is installed!
Read "Accessing the Feature" in phonegap's documentation for InAppBrowser

Accessing the Feature

As of version 3.0, Cordova implements device-level APIs as plugins. Use the CLI's plugin command, described in The Command-line Interface, to add or remove this feature for a project:

    $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
    $ cordova plugin rm org
.apache.cordova.core.inappbrowser
Reply all
Reply to author
Forward
0 new messages