views:

29

answers:

0

I've been trying for hours with all the different delegate methods to access the content of an XHR request that is automatically requested when a page is loaded.

I have used the following which has shown that WebKit is seeing the request in the first place (as the URL that's displayed is the correct one).

- (void)webView:(WebView *)sender resource:(id)identifier didReceiveResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource {
    NSURL *url = [response URL];

    NSLog(@"absoluteString %f", [url absoluteString]);
}

However I would like the actual HTML content received by the request:

- (void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource {

}

That seems like the place it should be but I must be accessing the wrong variables inside of it as I always seem to get the content of the original page and not the XHR content.