cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <>
Subject [jira] [Commented] (CB-2225) User-Agent changes in the CordovaWebView after using InAppBrowser
Date Fri, 18 Jan 2013 15:14:13 GMT


Andrew Grieve commented on CB-2225:

Did some research with this:

-Does the UA always for each PDF open, or only the first PDF load
   -Only the first time

-Can we load pdfs in an iframe, does this trigger the bug?
   -PDFs *do* load in iframes, but don't trigger the bug.

-Can we detect PDF loads?
   -They have a nil URL in their request object when webViewDidStartLoad is called, but not
webViewDidFinishLoad nor shouldLoad
   -It's likely that we could identify a PDF in our NSURLProtocol handler, but only if we
proxy the request

So..., some possible Solutions:

#1 - After loading first page, load a background UIWebView with a PDF (maybe even use data

#2 - Detect PDF load (via the nil URL), and let it load *without* changing the user-agent.
   - Make sure the load works by temporarily adding the URL to the container's whitelist
   - If the user tries to navigate anywhere else with the UIWebView, close it and make a new
   - This method still messes things up if there are more than one active CDV webviews

#3 - Block all PDF loads
   - Not sure this is easy to do without proxying every request, which has other side-effects

I think the first option is probably the best for starters, it's possible the the UA bug is
triggered from some sub-system being loaded the first time a PDF is loaded, and so doing it
every time will cause the app to use more memory than it requires. Maybe we could have a user-pref
that would allow the bug work-around to be disabled if they are sure that their app can't
be used to navigate to a PDF, or if they don't use a whitelist anyways.

> User-Agent changes in the CordovaWebView after using InAppBrowser
> -----------------------------------------------------------------
>                 Key: CB-2225
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Assignee: Andrew Grieve
>             Fix For: 2.4.0
>         Attachments:
> See CB-2102.
> Attached which I tested with Cordova 2.3.0.
> Repro:
> 1. On the main index.html, touch the "UserAgent" button, observe that the UA has a numbered
suffix (correct)
> 2. Touch the "About" link to go to the About page
> 3. On the About page, touch the "UserAgent" button, observe that the UA has a numbered
suffix (correct, it's the same as in (1))
> 4. Touch the "English" link, this will load a PDF in the InAppBrowser
> 5. Touch the "Done" button in the InAppBrowser to dismiss it
> 6. Now you are back to the "About" page, touch the "UserAgent" button again, and note
that the UA is not the same as expected in (3)

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