Reputation: 1037
I am looking for a way to detect what files a users web browser can display (natively or via plugin), either server side in PHP or client side in JavaScript. Basically, I want to have a box in which a file is displayed (audio in an <embed>
, documents in a <frame>
, etc), however if the browser is simply incapable of displaying the file, I want to show the user an error and give them a link to download it.
Thanks for any help.
Upvotes: 1
Views: 93
Reputation: 65
what happen if user turn off javascript ? PHP $_SERVER['HTTP_USER_AGENT'] can be faked, even a newbie can do this with User Agent Switcher (a firefox addon) i think there isn't a absolute solution for this.
Upvotes: 0
Reputation: 34038
Your best bet is going to be to determine what browsers are supported and which ones aren't and then use browser detection to determine what response to send to the client.
Quirksmode has a great script for this purpose as well as a demo on this page:
http://www.quirksmode.org/js/detect.html
Upvotes: 2