> On Mar 20, 2017, at 10:00 PM, Rick Aurbach <[email protected]> wrote:
> 
> BUT...what I want to do next is to click on a link on a webpage (i.e., an <a 
> href=“”> element pointing to a ‘.poetry’ file) and have the file downloaded 
> and opened by my app.

To be a little bit pedantic: it’s best not to think about things on the web as 
‘files’; it gives you a misleading idea of how they work. The general term is 
resources. They’re likely not stored in the filesystem on the server, the HTTP 
protocol is not like a network filesystem, and the browser on your device is 
not treating these resources as files unless it’s explicitly told to download 
them.

> What currently is happening is that clicking on the link causes the file to 
> be displayed as if it were text in Safari/iOS.

Sounds like the HTTP response has a Content-Type of some sort of text. HTTP 
resources have MIME types, which are the authoritative information of what type 
of data they are. The suffix in the name is usually ignored, except as a 
heuristic to call back to if there isn’t a meaningful Content-Type.

The MIME type of the resource is up to the server. If this resource really is a 
file uploaded to the server, then the server will need to have a mapping 
somewhere that tells it what filename extension maps to what MIME type. 
Otherwise it’ll probably make one up, maybe by looking at the beginning of the 
data and deciding whether it looks like text.

—Jens
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to