Is it possible from a httprequest, to extract the image types/mimes, that the client browser support.
I know that it is possible determine what the browser is, and the preferred image type, but not a list of all the supported.
It this even possible?
I am currently trying to optimize the mediahandling of my page, Webscore indicate that nextGen image should be served, as the once served now are too big.
Serving nextgen is not that difficult, currently is all the nextgen version not supported by all the browsers, and support list is currently hardcoded in a switch case. It would be neat if the client browser could provide me with info regarding what it supports, rather than having a list that very likely might become outdated due to updates.
This is why I am seeking for browser media format compatibility list from the mediaRequest been sent.
navigator.mimeTypes would only list you the browser supported types within the browser navigation scope at that time. For more reference;
navigator.mimeTypes Explained
browserContext Explained
As to my knowledge, there is no way of getting the browser specific full list with any existing api. Moreover, stack will not be compatible with other browsers as shown in compatibility diagram.
navigator.mimeTypes compatibility
Additionally, if getting the supported mime types through plugins collection of the browser (only supported on Chrome and Firefox) you can do something like;
var mimeCheck = function (type)
{
return Array.prototype.reduce.call(navigator.plugins, function (supported, plugin) {
return supported || Array.prototype.reduce.call(plugin, function (supported, mime) {
return supported || mime.type == type;
}, supported);
}, false);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With