【问题标题】:HTML\PHP : Flash Player detection techniqueHTML\PHP : Flash Player 检测技术
【发布时间】:2010-09-27 15:08:40
【问题描述】:

当我们在我们的网站上放置 Flash 文件时,它在场外需要客户端计算机上的 Flash 播放器,并提示安装 Flash 播放器...

是否有一些 php 代码可以用来检查客户端机器上是否有 flash 播放器的天气,如果没有,那么我不是放置\嵌入 flash 文件,而是在其中放置图像...

因为在我的具体情况下,flash 并不是那么重要……它只是用于化妆品、动画……我可以用 gif 或简单的 jpeg 代替,没关系……

但是我能做到吗

【问题讨论】:

  • 用代码示例更新了我的答案...

标签: php html flash


【解决方案1】:

swfobject 可以提供帮助。

如果flash不能显示在flash对象应该在的代码中,你可以只放置要显示的内容,并将脚本指向它。

在代码中:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>TestFlash</title>

    <!--import the swfobject library /-->
    <script type="text/javascript" src="swfobject.js"></script>

    <!--Define which div (by ID) gets replaced if flash is present /-->
    <script type="text/javascript">
        swfobject.embedSWF("myContent.swf", "flash1", "300", "120", "9.0.0");
    </script>

</head>

<body>

    <h1>We are testing some flash</h1>
    <hr />

    <div id="flash1">
        <!-- This stuff will show if flash is not present on the machine  /-->
        <img src="/img/image1.jpg" />
    </div>

    <hr />
    <h2>this is a footer</h2>


</body>
</html>

【讨论】:

【解决方案2】:

查看这篇文章 - http://www.adobe.com/devnet/flash/articles/fp8_detection.html

Adobe 现已对此进行了排序,因此您可以展示替代内容/指导用户安装 flash/检测用户拥有的 flash 版本,然后根据需要从您的网站安装最新版本,而无需访问 adobe 网站。

要实现这一点需要做一些工作,因此取决于用户使用 Flash 的重要性,或者替代内容是否也能正常工作。但是为了提供 Flash 内容并确保用户安装了正确的版本,Flash 检测工具包效果很好。

【讨论】:

  • ...我重新阅读了您的问题,虽然我的建议对于检测 Flash 版本很有用,但对于您的情况来说可能是矫枉过正。我会按照 powertieke 的建议考虑使用 swfobject - 我投票赞成这个答案。
【解决方案3】:

怎么样

<?
// Search through the HTTP_ACCEPT header for the Flash Player MIME type.
if (strstr($_SERVER['HTTP_ACCEPT'], 'application/x-shockwave-flash'))
{
$hasFlash = true;
}

if ($hasFlash)
{
        // EMBED
} else {
       // IMG
};

?> 

【讨论】:

  • 这将如何工作? $hasFlash 在哪里以及如何定义?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-07
  • 1970-01-01
  • 1970-01-01
  • 2011-04-21
  • 2011-11-12
  • 2011-02-04
  • 2011-07-21
相关资源
最近更新 更多