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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -