incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: API function: Open url in system web browser
Date Sun, 20 May 2012 18:01:52 GMT
iOS doesn't differentiate between target attributes in my testing. If you
set it to _self or _blank, it would always set navigationType to
UIWebViewNavigationTypeOther, so I don't know how you are getting these
results. Send me your test project so I can verify your results and confirm.

This is what I've said in the issue:
>From my tests, any anchor target value will trigger a new request, with its
UIWebViewNavigationType as UIWebViewNavigationTypeOther which Apple defines
as "Some other action occurred." in their docs for UIWebView (not really
helpful), thus there is no way to differentiate between "_self" or
"_blank". We are treating any target value as "_blank" effectively."



On Sun, May 20, 2012 at 10:32 AM, Randy McMillan <
randy.lee.mcmillan@gmail.com> wrote:

> Demo app for fix:
>
> https://github.com/RandyMcMillan/openInSafari
>
> This fix seems to work as expected.
>
> Adding this to the MainViewController.m
>
> -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType;
>
>     {
>         NSURL *requestURL =[ [ request URL ] retain ];
>         if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL scheme
] isEqualToString: @"https" ] || [ [ requestURL scheme ] isEqualToString: @"mailto" ]) &&
( /*navigationType == UIWebViewNavigationTypeLinkClicked ||*/ navigationType == UIWebViewNavigationTypeOther
) )
>            { return ![ [ UIApplication sharedApplication ] openURL: [ requestURL autorelease
] ]; }
>         [ requestURL release ];
>           return YES;
>     }
>
>
>
> provides the expected functionality
>
>
> _self and _blank function correctly on *phonegap* in the whitelist.
>
>
>
>
>
>
> Using the http://docs.phonegap.com subdomain in contrast to
> http://phonegap.com seemed to be a rigorous test because it is on the
> same domain and tests _blank and _self adherence to the whitelist
>
> Also to further test this fix navigate thru the page and find an external
> link. You will see that the whitelist is still in effect.
>
> follow the phoengap.com link
> then navigate to an external link for example the adobe terms of use link
> at the bottom of the page.
>
>
>
>
>
>
>
>
>
>

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message