是Opera Turbo吗?

yun*_*zen 4 javascript flash opera opera-turbo

我有一个使用Flash动画的页面(这些并不重要但是额外的).

一切正常,如果我没有使用Opera激活Turbo.然后,Flash电影在闪光电影大小的圆圈中显示为一个大的丑陋箭头,用作闪光灯的播放按钮.

我正在使用SWFobject,所以如果我知道是否使用了Opera的turbo机制,我就可以轻松转动动画,但是如何在JavaScript(或者如果这样的话可能是CSS)中这样做


如何重现?
浏览此页面使用Opera(或任何其他使用闪存的页面)
http://www.adobe.com/software/flash/about/
如果没有Opera Turbo,您会看到Flash动画和flash版本信息使用Opera Turbo,您会看到两个白色箭头在灰色圆圈


编辑1我现在很确定,没有纯粹的JS解决方案,也没有PHP解决方案.最好的猜测是AS/JS组合解决方案.

mar*_*cio 5

客户端检测:无法通过javascript访问它.目前无法对歌剧涡轮增压器进行客户端检测,未来可能会支持,但谁知道呢?

服务器端检测:当启用Opera turbo时,来自客户端的所有请求都将完成到Opera服务器,Opera服务器将访问您的应用程序(执行压缩)并将处理后的内容转发到最终客户端(用户的计算机).

考虑到这一点,让我们做一些网络嗅探,看看你的连接在哪里:

~$ nslookup opera10beta-turbo.opera-mini.net
>Server:        189.40.226.80
>Address:   189.40.226.80#53
>Non-authoritative answer:
>opera10beta-turbo.opera-mini.net   canonical name = global-turbo-1.opera-mini.net.
>Name:  global-turbo-1.opera-mini.net
>Address: 141.0.11.252

~$ nslookup 64.255.180.252
>Server:        192.168.1.254
>Address:   192.168.1.254#53
>Non-authoritative answer:
>252.180.255.64.in-addr.arpa    canonical name = 252.0-24.180.255.64.in-addr.arpa.
>252.0-24.180.255.64.in-addr.arpa   name = global-turbo-1-lvs-usa.opera-mini.net.
Run Code Online (Sandbox Code Playgroud)

如您所见,Opera服务器中的名称和规范名称可用于检测您是否通过opera服务器中介访问应用程序.我认为服务器端编码可以处理(不确定您在服务器上使用的语言).

如果您正在访问本地服务器中的某些内容,请记住Opera Turbo不会中介您的请求.

希望能帮助到你.


Les*_*que 2

您可以尝试检查 Flash 对象是否加载了一些 JavaScript。这段代码可以在我的 Opera 11 电脑上运行:

<html>
<head>
  <script language=JavaScript>
    function isFlashBlocked(){
      var blocked;
      try {
        // Can test this on any flash object on the page
        window.document.myFlash.SetVariable("dummy", "dummy");
        // Flash not blocked
        blocked = false;
      }
      catch(err) {
        // Flash blocked
        blocked = true;
      }

      return blocked;
    }

    function removeBlockedFlash() {
      if (isFlashBlocked()) {
        // Hide all flash objects
        window.document.myFlash.setAttribute("style", "display: none");
        // ...

        // Display replacement content
        window.document.myImage.setAttribute("style", "display: inline");
        // ...
      }
    }
  </script>
</head>
<body onload="removeBlockedFlash()">
  <object type="application/x-shockwave-flash" data="HelloWorld.swf" 
          width="100" height="100" id="myFlash">
  </object>
  <img src="image.jpg" style="display: none" id="myImage" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

如果您检测到闪光灯被阻挡,您可以隐藏每个闪光灯对象并显示您想要的内容。

编辑:此代码不适用于 Firefox,您可能需要在使用此功能之前检测浏览器。