无法在 Firefox 上单击 Flash 中的允许按钮 [英] Can't click allow button in flash on firefox

查看:24
本文介绍了无法在 Firefox 上单击 Flash 中的允许按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 web 应用程序在 iframe 中嵌入了一些 Flash 内容.flash 部分正在请求访问网络摄像头.在 firefox/mac os 上,用户无法单击允许按钮.这仅在嵌入 swf 文件的页面加载到 iframe 中时发生,单独加载时它工作正常.有没有其他人遇到过类似的问题?你知道任何解决方法吗?

I have a webapp embedding some flash content in an iframe. The flash part is requesting access to the webcam. On firefox/mac os, user's can't click the allow button. This only happens when the page embedding the swf file is loaded in the iframe, it works fine when laded separately. Has anyone else faced a similar problem? Do you know any workarounds?

供将来参考:我们通过 JS 定位一些东西,我们使用半像素"(例如 20.5px)定位.一旦我们确定一切正常.

For future reference: we were positioning some stuff via JS and we had positions using "half pixels" (e.g. 20.5px). Once we fixed that everything worked fine.

推荐答案

我发现在CSS中使用margin auto的情况下也会存在这个bug.

I found that this bug will also exist in situations when you use margin auto in CSS.

例如,在固定宽度&居中对齐的布局通常使用margin: 0px auto;"保持内容居中.这似乎可以很好地为内容生成可能的(可能的)十进制左/右页边距.这对 Firefox 来说并不是真正的问题.它可以很好地处理十进制像素偏移.

For example, in a fixed width & center aligned layout its typical to use "margin: 0px auto;" to keep a content well centered. This seems to produce possible (likely) decimal left/right margins for the content well. That isn't really a problem for Firefox.. it handles decimal pixel offsets just fine.

但是当 Flash 小部件的对象容器使用十进制像素值定位时,它们似乎完全吓坏了.至少,您不能与允许"按钮交互.对我来说,这似乎是这个错误的根本原因,你会看到许多人广泛报告(因为它至少与 FF 相关).

But Flash widgets totally seem to freak out when their object container are positioned with decimal pixel values. At minimum, you cannot interact with the "Allow" button. To me, this seems to be the root cause of this bug you will see widely reported by many (as it pertains to FF atleast).

至于为什么它只出现在 FF 中,我不完全确定.在我的 OSX 机器上,Safari 和 Chrome 不会对 Flash 对象表现出这种行为.也许 Webkit 中的所有 DOM 元素都会自动使用舍入的像素偏移值进行渲染?

As for why it only occurs in FF, I'm not entirely sure. On my OSX machine, Safari and Chrome don't exhibit this behavior with flash objects. Perhaps all DOM elements in Webkit are rendered with rounded pixel offset values automatically?

对于 Firefox,我实现了这个解决方法(对于居中对齐的设计很有用):

For Firefox, I implemented this workaround (useful for center aligned designs):

$(document).ready( function() {
  repositionContentContainer();
});

function repositionContentContainer() {
  // this routine is a complete hack to work around the flash "Allow" button bug
  if ( $("#content").length > 0 ) {

    //Adjust the #content left-margin, since by default it likely isn't an int
    setLeftMargin();
    //If the User resizes the window, adjust the #content left-margin
    $(window).bind("resize", function() { setLeftMargin(); });
  }
}

function setLeftMargin() {
  var newWindowWidth = $(window).width();
  var mainWellWidth = $("#content").width();
  // create an integer based left_offset number
  var left_offset = parseInt((newWindowWidth - mainWellWidth)/2.0);
  if (left_offset < 0) { left_offset = 0; }
  $("#content").css("margin-left", left_offset);
}

这篇关于无法在 Firefox 上单击 Flash 中的允许按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆