开发者

Detecting browser file compatibility

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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜