i loading webview method:-
nsstring *urlstring = self.urltoload; nsurl *url = [nsurl urlwithstring:urlstring]; nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url]; [self.view_webview loadrequest:urlrequest]; self.view_webview.delegate=self;
first have implement web view delegate method :
- (bool)webview:(uiwebview *)_webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype now try detect url want open in safari browser
- (bool)webview:(uiwebview *)_webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nsstring urlloading = request.url.absolutestring; if ([urlloading isequaltostring:@"url_that_you_want_to_load"]) { [webview stoploading]; //open url in external browser [[uiapplication sharedapplication] openurl:request.url]; } return yes; }
Comments
Post a Comment