开发者

How reliable is server side detection of flash?

In answering a question on stack overflow, one person recommended using the following code to detect flash server-side, he pointed out that it does not work i开发者_StackOverflown safari:

if (strstr($_SERVER['HTTP_ACCEPT'], 'application/x-shockwave-flash')){
$hasFlash = true;} 

Testing for Flash capability on the server-side

My question: why does it not work in safari, and how reliably does it work with other browsers?


That's because Safari decided not to send the HTTP_ACCEPT headers of every single possible "acceptable" request, including Flash. It will be highly unreliable to perform the test like this.

A better way of doing it could be to test on the client side using Javascript, set a cookie, then redirect.


All I could think of is that the mime type would not be detected properly by Safari. Safari might not recognize what application/x-shockwave-flash means. I tried to find similar stories in Google but unsuccessful.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜