无法点击Firefox上的flash中的允许按钮

Ale*_*lex 19 flash firefox

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

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

sgh*_*ael 16

我发现当你在CSS中使用margin auto时,这个bug也会存在.

例如,在固定宽度和中心对齐布局中,其典型使用"margin:0px auto;" 保持内容集中.这似乎为内容产生了可能的(可能的)十进制左/右边距.对于Firefox来说这不是一个真正的问题..它处理十进制像素偏移就好了.

但是Flash小部件在他们的对象容器定位有小数像素值时似乎总是吓坏了.至少,您无法与"允许"按钮进行交互.对我来说,这似乎是这个错误的根本原因,你会看到许多人广泛报道(因为它与FF atleast有关).

至于为什么它只出现在FF中,我不完全确定.在我的OSX计算机上,Safari和Chrome不会对flash对象表现出这种行为.也许Webkit中的所有DOM元素都会自动呈现圆角像素偏移值?

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

$(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);
}
Run Code Online (Sandbox Code Playgroud)


you*_*es0 7

wmode设置为' direct '修复此问题.
无需将"margin"/"position"值设置为整数.

请注意,"直接"wmode自Flash 10起可用,并且在IE下不起作用