1

I read this question but it doesn't fully answer mine.

In the linked question, the OP asks what he must do to have his custom media type registered. I do not need that.

All I'm asking is, that if I am correct in assuming that, technically, all I have to do to create a custom media type is to, well.. just use it in my communication?

Basically, what I want to do is that my website offers a download of a file, described as application/x-my-custom-thing. On the client, the user has files ending with .my-custom-thing set as to open with the application I ship along.

So, what should happen is that, when the user clicks on the link, my application opens and reads the file and does stuff with it.

Are media types even the proper use case for this? Or, should I maybe "create" my own protocol in the sense of mycustomthing://example.com/the-file-to-use? Will that work with every (reasonably modern) browser?

2

The primary purpose for media types used in HTTP communication is to tell the browser how they should treat the received content.

If you use the browser just to let the user to download the files to their computer, then you don't need to create your own media type. It will be sufficient to use the standard generic media type application/octet-stream.
If you want the browser to do more, then the user (or perhaps an installer) must associate your custom media type with your application. There is no automatic association and no relation between file extensions and media types (and some OSes don't even use the file extension to identify the type of file and how to open it).

Defining a custom protocol is unlikely to work. A protocol defines how the browser communicates with a server and browsers will not accept URIs with a protocol that they don't know.

  • 1
    Not only will they not accept unknown protocols, they can't! If the protocol is unknown, then the browser by definition doesn't even know what to send and to receive or even how to send. – Jörg W Mittag Jul 25 '14 at 10:58
  • Okay, so basically I should associate my application with the media type that i add to the download. Will this automatically launch the application that is associated? The system needs to be as user interaction poor as possible, so the target is that the user clicks "Download" and the application starts with the downloaded file, performs the reuquired actions, and closes again. – F.P Jul 25 '14 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.