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.
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]];
}
}
精彩评论