Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercepting spawned URL requests from UIWebView

I'm trying to cache specified web pages to disk by NSURLProtocol,now I can only get the first URL request, but the UIWebView spawns further URL requests for loading graphics. So how can I Intercept all the requests spawned by UIWebView from the first URL? Thank you very much!

like image 415
Suge Avatar asked Mar 03 '26 02:03

Suge


1 Answers

Implement delegate method

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

every time your webview loads url it will first call this method.

like image 134
Mihir Mehta Avatar answered Mar 04 '26 17:03

Mihir Mehta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!