cordova-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/CB-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13557264#comment-13557264
] 

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
URL)

#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
one
   - 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: https://issues.apache.org/jira/browse/CB-2225
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Assignee: Andrew Grieve
>             Fix For: 2.4.0
>
>         Attachments: www-cb-2102.zip
>
>
> See CB-2102.
> Attached www-cb-2102.zip 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: http://www.atlassian.com/software/jira

Mime
View raw message