简体   繁体   English

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

[英]Can't click allow button in flash on firefox

I have a webapp embedding some flash content in an iframe. 我有一个webapp在iframe中嵌入了一些flash内容。 The flash part is requesting access to the webcam. 闪存部分正在请求访问网络摄像头。 On firefox/mac os, user's can't click the allow button. 在firefox / mac os上,用户无法单击允许按钮。 This only happens when the page embedding the swf file is loaded in the iframe, it works fine when laded separately. 这只发生在嵌入swf文件的页面加载到iframe中时,单独使用时它可以正常工作。 Has anyone else faced a similar problem? 还有其他人遇到过类似的问题吗? Do you know any workarounds? 你知道任何变通方法吗?

EDIT: For future reference: we were positioning some stuff via JS and we had positions using "half pixels" (eg 20.5px). 编辑:为了将来的参考:我们通过JS定位一些东西,我们使用“半像素”(例如20.5px)的位置。 Once we fixed that everything worked fine. 一旦我们确定一切正常。

I found that this bug will also exist in situations when you use margin auto in CSS. 我发现当你在CSS中使用margin auto时,这个bug也会存在。

For example, in a fixed width & center aligned layout its typical to use "margin: 0px auto;" 例如,在固定宽度和中心对齐布局中,其典型使用“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. 对于Firefox来说这不是一个真正的问题..它处理十进制像素偏移就好了。

But Flash widgets totally seem to freak out when their object container are positioned with decimal pixel values. 但是Flash小部件在他们的对象容器定位有小数像素值时似乎总是吓坏了。 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 atleast有关)。

As for why it only occurs in FF, I'm not entirely sure. 至于为什么它只出现在FF中,我不完全确定。 On my OSX machine, Safari and Chrome don't exhibit this behavior with flash objects. 在我的OSX计算机上,Safari和Chrome不会对flash对象表现出这种行为。 Perhaps all DOM elements in Webkit are rendered with rounded pixel offset values automatically? 也许Webkit中的所有DOM元素都会自动呈现圆角像素偏移值?

For Firefox, I implemented this workaround (useful for center aligned designs): 对于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);
}

Setting the wmode to ' direct ' fixed this. wmode设置为' direct '修复此问题。
No need to set 'margin' / 'position' values as integers. 无需将“margin”/“position”值设置为整数。

Note that 'direct' wmode is available since Flash 10 and doesn't work under IE 请注意,“直接”wmode自Flash 10起可用,并且在IE下不起作用

This issue is being tracked at the Adobe bug database: Adobe错误数据库正在跟踪此问题:

http://bugs.adobe.com/jira/browse/FP-4656 http://bugs.adobe.com/jira/browse/FP-4656

The basic issue is that Firefox uses half-pixel positioning, and adobe uses it irregularly after resizing. 基本问题是Firefox使用半像素定位,adobe在调整大小后不规则地使用它。 This comes about through centered swfs on a page, or is made even worse if the swf is inside a centered iframe, such as most facebook apps. 这是通过页面上的中心swfs实现的,或者如果swf位于居中的iframe内部(例如大多数facebook应用程序),则更糟糕。

There is a solution matrix posted there that covers browser zooming, resizing, and other complications. 这里有一个解决方案矩阵,涵盖了浏览器缩放,调整大小和其他复杂功能。

I know this is an old question but I've just discovered another issue that was causing the same bug, and this is the top Google result so I'm adding this answer. 我知道这是一个老问题,但我刚发现另一个导致相同错误的问题,这是谷歌的最高结果,所以我添加了这个答案。

A CSS3 gradient on your page background (possibly on container div backgrounds as well) will also cause this issue. 页面背景上的CSS3渐变(也可能在容器div背景上)也会导致此问题。 Remove the gradient and the button is clickable again. 删除渐变,再次单击该按钮。

检查你没有任何父div(或div本身)与CSS转换规则,例如:

transform: translateX(-50%);

I was able to make it work. 我能够让它发挥作用。 Ahuh! Ahuh!

Use Tab button until it highlights the whole Flash Player settings box, then press Tab button again until it highlights the "question mark" button on the right upper part of the box. 使用“选项卡”按钮,直到它突出显示整个Flash Player设置框,然后再次按Tab键,直到它突出显示框右上方的“问号”按钮。 Press Space bar or Enter button repeatedly until it opens another tab on your browser. 反复按空格键或Enter按钮,直到它在浏览器上打开另一个选项卡。 Now go back from the previous page where the Flash Player settings is, press Tab button again until it highlights the "Allow button" or "Deny button" depending on what will you do. 现在返回Flash Player设置的上一页,再次按Tab键,直到它突出显示“允许按钮”或“拒绝按钮”,具体取决于您将做什么。 Press Space bar or Enter button and voila! 按空格键或Enter按钮,然后瞧! There you go! 你去!

Hope it helps. 希望能帮助到你。 Have a pleasant evening everyone! 大家度过愉快的夜晚! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM