Opera Turbo 开启了吗?

发布于 2024-12-26 01:24:08 字数 570 浏览 2 评论 0原文

我有一个使用 Flash 和动画的页面(这些不是关键的,而是附加的)。

如果我不使用激活 Turbo 的 Opera,一切都会正常。然后,Flash 影片显示为 Flash 影片大小的圆圈中的一个丑陋的大箭头,旨在充当 Flash 的播放按钮。

我正在使用 SWFobject,因此如果我知道是否使用了 Opera 的涡轮机制,我可以轻松地关闭动画,但是我如何在 JavaScript 中执行此操作(或者如果可以的话,可能是 CSS)


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


编辑 1 我现在非常确定,不存在纯 JS 解决方案,也不存在 PHP 解决方案。最好的猜测是组合 AS/JS 解决方案。

I've got a page which uses Flash with animations (These are not crucial but additional).

Everything works fine, if I'm not using Opera with activated Turbo. Then the Flash Movie is shown as a big ugly arrow in a circle the size of the flash movie which is intended to act as a play button for the flash.

I'm using SWFobject, so I easily could turn of the animation if I knew if Opera's turbo mechanism is used, but how do I do this in JavaScript (or maybe CSS if this goes)


How to reproduce?
Surf this page with Opera (or any other page which uses flash)
http://www.adobe.com/software/flash/about/
Without Opera Turbo you see a flash animation and flash version information
With Opera Turbo you see two white arrows in gray circles


edit 1
I'm quite sure now, that there is not a pure JS solution and not a PHP solution. The best guess is a combined AS/JS solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

捎一片雪花 2025-01-02 01:24:08

客户端检测
无法通过 javascript 访问它。目前无法实现 Opera Turbo 的客户端检测,也许将来会支持,但谁知道呢?

服务器端检测
启用 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.

正如您所看到的,Opera 服务器中的名称和规范名称可用于检测您的应用程序是否正在通过 Opera 服务器中介进行访问。我认为服务器端编码可以处理这个问题(不确定您在服务器上使用什么语言)。

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

希望有帮助。

Client side detection:
There is no way to access that through javascript. Client side detection for opera turbo is not possible currently, maybe it will be supported in the future but who knows?

Server side detection:
When opera turbo is enabled all requests from client are done to opera servers, the opera servers are going to access your application (do compressions) and forward the processed content to the final client (user's computer).

With that in mind, let's do some network sniffing and see where are your connection going:

~$ 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.

As you can see the name and canonical name from opera servers can be used to detect if you application is being accessed through opera servers intermediation. I think server side coding could handle that (not sure what language are you using on your server).

It's good to remember that Opera Turbo will not intermediate your requests if you're accessing something in your local server.

Hope it helps.

箹锭⒈辈孓 2025-01-02 01:24:08

您可以尝试检查 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>

如果您检测到 Flash 被阻止,您将隐藏每个 Flash 对象并显示您想要的内容。

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

You can try to check if the flash object is loaded with some javascript. This code works on my computer with 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>

If you detect that flash is blocked, you hide every flash object and display what you want.

Edit: This code doesn't work with Firefox, you probably need to detect the browser before using this function.

二智少女猫性小仙女 2025-01-02 01:24:08

我相信速度问题的答案是最初不下载 Flash 内容。您必须手动单击该图标才能下载。 GIF 动画也是如此。这是提高速度策略的一部分。 (参见这篇 Opera Desktop 团队帖子

)为什么您想知道如何检查 Opera Turbo,而不仅仅是 Opera。从我的本地测试来看,我无法使用 PHP 的 _SERVER["HTTP_USER_AGENT"] 变量来区分差异。我认为这类似于 Opera 列出的用户代理字符串,如此处所示此处

看来,Opera 不是将浏览器状况通知网站,而是默默地以不同的方式管理请求结果。

I believe that the answer to the speed issue is that the Flash content is not downloaded initially. You have to manually click on the icon to download it. Same for animated GIFs. This is part of the strategy to boost the speed. (cf., this Opera Desktop Team post.)

Which is why you want to know how to check for Opera Turbo, and not just Opera. From my local tests, I cannot tell the difference using PHP's _SERVER["HTTP_USER_AGENT"] variable. I think this is similar to what Opera lists as the user agent string, as shown here and here.

It seems that, rather notifying the website of the browser condition, Opera silently manages the request results differently.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文