3

I'm listening for url loads from my UIWebView. Is there a way to check if the request has a target of "_blank"?:

- (BOOL) webView:(UIWebView *)webView
         shouldStartLoadWithRequest:(NSURLRequest *)request
         navigationType:(UIWebViewNavigationType)navigationType
{
    if ([request targetIs:@"_blank"]) {
        // do something.
    }
}
Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184
user1219278
  • 1,859
  • 5
  • 22
  • 27

2 Answers2

1

Don't know about iOS, but as for OS X, it works perfectly, if you use policy delegate. I've placed my answer in this thread, mentioned by Russ above.

DeadlineX
  • 129
  • 1
  • 4
0

Maybe you can use [UIWebView -request] to get the NSURLRequest, and use [NSURLRequest URL] to check if the url contains anything you want.

CarmeloS
  • 7,868
  • 8
  • 56
  • 103