ios - UIWebView get user touch on tapping link -
i want perform action when user clicks link on uiwebview
. doing making work :
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nslog(@"request - %@", request.url.absolutestring); [webview.window makekeyandvisible]; [[uiapplication sharedapplication] setnetworkactivityindicatorvisible:yes]; if(isfirsttimeloaded) { [self shotoolbar]; [self updatebuttons]; } return yes; } - (void)webviewdidfinishload:(uiwebview *)webview { isfirsttimeloaded = yes; }
this works fine. doesn't when uiwebview
's first load involves multiple redirection while loading page. want fire condition when user intentionally clicks on link. not on url redirection of uiwebview
.
you have check navigationtype
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { if (navigationtype==uiwebviewnavigationtypelinkclicked) { // link } else { // wasn't link } return yes; }
Comments
Post a Comment