Opening popup links in UIWebView, possible?

前端 未结 4 986
旧时难觅i
旧时难觅i 2020-12-01 08:53

I have a UIWebView which I\'m using as an embedded browser within my app.

I\'ve noticed that links in webpages that open new windows are ignored without any call int

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 09:12

    Here's how I get twitter links to work (i.e. link to pages that try to open with new windows):

    -(BOOL)webView:(UIWebView *)mainWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    
        if (navigationType == UIWebViewNavigationTypeLinkClicked) {
            //Allows for twitter links
            [self.mainWebView loadRequest:request];
            return NO;
        }
    
        return YES;
    
    }
    

提交回复
热议问题