Home:ALL Converter>Determine the Mimetype of an image in JavaScript?

Determine the Mimetype of an image in JavaScript?

Ask Time:2018-04-10T22:56:12         Author:Chris W.

Json Formatter

Given the URL of an image—on a domain which I control—how can I determine the mimetype of that image via client-side JavaScript?

There is no reliably available file extension as part of the URL.

I would strongly prefer to not have to build a server-side solution if possible (e.g., upload the image to a server and have it check for mimetype).

Author:Chris W.,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/49756854/determine-the-mimetype-of-an-image-in-javascript
yy