cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <>
Subject [jira] [Commented] (CB-2102) InAppBrowser will not open PDFs on different pages
Date Fri, 04 Jan 2013 00:08:14 GMT


Shazron Abdullah commented on CB-2102:


This problem only occurs on iOS 6.

On iOS 6, changing the main HTML page after the InAppBrowser has been closed results in that
new page picking up the User-Agent (UA) of the InAppBrowser, not the original one. This seems
to suggest in iOS 6, on a new webpage load, it re-reads the UserAgent property of NSUserDefaults
again (and sets navigator.userAgent anew), when on iOS 5 it does not. On iOS 5, it is set
once on UIWebView instantiation.

The problem lies in our XmlHttpRequest (xhr) bridge communication. We append the User-Agent
with a value that is tied to the current Cordova view controller (CDVViewController), that
is read by the CDVURLProtocol which determines whether we handle the Cordova exec call.

The workaround suggested is to re-set the UA back to what is expected, and this was tried.
The expected UA is successfully set on InAppBrowser exit, but now, when you navigate to a
new HTML page, all exec xhr requests just disappear without reaching the native layer. Poof.
Removing the code that sets the expected UA makes the communication work again.

Setting the bridge mode to iframe makes it work again, and this does not require the UA fix:
      var exec = cordova.require('cordova/exec');

If you have a multi-page app, and you use iOS 6, you must use iframe bridge mode.
> InAppBrowser will not open PDFs on different pages
> --------------------------------------------------
>                 Key: CB-2102
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 2.3.0
>         Environment: OSX Mountain Lion, xCode 4.5.2, happens on iPad simulator 5.0, 5.1,
>            Reporter: Chad Crowell
>            Assignee: Shazron Abdullah
>            Priority: Minor
>              Labels: InAppBrowser
>             Fix For: 2.3.0
> WWW folder is here:
> The folder structure here is setup exactly like the much more elaborate website we are
wrapping in Cordova as an "offline website browser" app for my client. This stripped down
version exhibits the same problematic behavior.
> Whichever page you view first, the PDFs on that page open in IAB just fine. Click over
to the other page and the PDFs there don't open in IAB. Doesn't matter which page you go to
first, the other page always doesn't work.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message