Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nomar383

macrumors 65816
Original poster
Jan 29, 2008
1,310
0
Rexburg, ID
Safari on the iPad is able to detect downloads and give you a warning if it doesn't understand how to handle them. How do I detect downloads in a similar manner for my iPad app?

I've been searching google for hours with no luck :(

My app needs to detect downloads that are generated and returned through scripts (php, javascript, etc) and then handle them. When I click a link in my UIWebView that functions in this manner, I get this error:
Error Domain=WebKitErrorDomain Code=102 UserInfo=0x514af70 "Frame load interrupted"

In Safari, I get a warning (via a UIAlert). So, I'm assuming Safari has some way to handle this and KNOWS that it's a download. Ideas?
 
Look in the UIWebview documentation for the webView:shouldStartLoadWithRequest:navigationType: method. You can inspect every URL before any network load starts, and reject the ones you don't want.
 
I tried using that method already, and I'm checking the "request" for what the URL is. The URLs that are being returned don't seem useful (no extension of any kind). So, I am unable to use something like NSData to download from the URL.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.