Browsers can display certain media inline, and will provided they are sent with content-disposition: inline
. What's the best way to detect whether the browser is capable of doing so with a particular type of media?
I am running into the question lately with PDFs and Mac/FF, which seems to refuse to display PDFs inline (actually, in iFrame), instead prompting a download. I don't mind the forced download; I'd just like to be able to anticipate it so that I can give the end user a nice "download" link rather than an iFrame that fails at displaying inline content. My current solution is just browser detection (sample code below), but surely there must be a better mode.
var isMacFF = window.navigator.userAgent.search(/Mozilla.*Mac/i) != -1