iOS UIWebView interacts with web pages and returns

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

{

    NSString *protocol = @"daojia://";

    NSString *requestString = [[request URL] absoluteString];

    /// Back button.

//    if ([requestString isEqualToString:@"daojia.close"]) {

        if (requestString && requestString. length > 150 ) { // Execute after the click time in the web page meets certain conditions:

 

//        [self.webView stopLoading];

//        [self.webView removeFromSuperview];

//        [self.navigationController popViewControllerAnimated:YES];

            

            // Jump to the activity list page

            NSString *urlString = [NSString stringWithFormat:@"http://%@/activity/",HOSTNAME];

            WebViewViewController *activitiesListVC = [[WebViewViewController alloc] initWithUrl:urlString];

            activitiesListVC.hidesBottomBarWhenPushed = YES;

            activitiesListVC.rightTopButtonStyle = WebVCRightTopButtonStyle_MyActivity;

            [ AVAnalytics event : @" Enter the event entry " ];

            [self.navigationController pushViewController:activitiesListVC animated:YES];

    }

    returnYES;

    

    // Return to the previous level of the web page. ----- Implemented in the back button

//    if ([self.webView canGoBack]) {

//        [self.webView goBack];

//    } else {

//        [self.navigationController popViewControllerAnimated:YES];

//    }

 

}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327058713&siteId=291194637