views:

52

answers:

1

I am opening an html page in web view and By Clicking an html link i want to open the given link in to web browser and my application should close.

A: 

implement UIWebView's shouldStartLoadWithRequest delegete method and inside it write

-(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType {

    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
              [[UIApplication sharedApplication] openURL:[request URL]];
      }
}
mihirpmehta
when this method will call?
Ankit Vyas
it will call automatically when any action is taken on UIwebView... but you need to set UIWebView's delegate to that particular class...
mihirpmehta
Thank you Very Much it working!Thanks a lot
Ankit Vyas