I use this to detect whether user logins successfully:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *urlStr = LOGIN_OK_URL;
NSString *urlStr1 = LOGIN_OK_URL_1;
if([URLString hasPrefix:urlStr] || [URLString hasPrefix:urlStr1]){
// login successfully, dismiss this view
} else if ([URLString hasPrefix:URL_LOGIN_CANCEL] == 1 || [URLString isEqualToString:URL_LOGOUT_CANCEL]) {
// user presses cancel button, dismiss this view
}
// processing login page
return YES
}
Detect the login button was pressed: how to intercept Button click inside UIWebview on IOS?