WebView setDownloadDelegate: issue
WebView setDownloadDelegate: issue
- Subject: WebView setDownloadDelegate: issue
- From: Mikkel Eriksen <email@hidden>
- Date: Fri, 24 Apr 2009 12:29:31 +0200
Hi foks
Hopefully the right place to ask this question.
In the project I'm working on, I have a webview that's going to a
specific site. When the user downloads files from that site, I want to
intercept them (basically grab the URL, get the file and parse the
contents).
So in my controller class I have
IBOutlet WebView *webview; //in controller.h
//and
[webview setDownloadDelegate:self]; //in the controller awakeFromNib
//I also took this from Hillegass' book to get a feel for how
downloads work (what delegate methods are called and when):
- (BOOL)respondsToSelector:(SEL)aSelector
{
NSString *methodName = NSStringFromSelector(aSelector);
NSLog(@"respondsToSelector: %@", methodName);
return [super respondsToSelector:aSelector];
}
Now that works with a sampling of random sites I went to:
2009-04-23 22:01:41.122 AO[42395:10b] respondsToSelector: downloadDidBegin:
2009-04-23 22:01:41.124 AO[42395:10b] respondsToSelector:
download:willSendRequest:redirectResponse:
2009-04-23 22:01:41.458 AO[42395:10b] respondsToSelector:
download:didReceiveResponse:
2009-04-23 22:01:41.460 AO[42395:10b] respondsToSelector:
download:didReceiveDataOfLength:
2009-04-23 22:01:41.569 AO[42395:10b] respondsToSelector:
download:didReceiveDataOfLength:
2009-04-23 22:01:41.983 AO[42395:10b] respondsToSelector:
download:decideDestinationWithSuggestedFilename:
2009-04-23 22:01:41.985 AO[42395:10b] respondsToSelector:
download:didCreateDestination:
etc
But with the specific links on that site, it did not work. No delegate
methods were called.
The problem as far as I can guess is that the links are actually
javascripts that fill out values in a form and submits it to the
server, which then spits out the file. Is there a clean way to
intercept these files?
Regards,
Mikkel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden