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

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

问题描述

我有一个web应用程序在iframe中嵌入一些Flash内容。闪光灯部分正在请求访问摄像头。在Firefox / Mac OS上,用户无法点击允许按钮。这只发生在嵌入swf文件的页面被加载到iframe中时,它在单独的情况下工作正常。有没有其他人面临类似的问题?你知道任何解决方法吗?编辑:为了将来的参考:我们通过JS定位一些东西,我们有位置使用半像素(例如20.5px)。一旦我们修好了,一切正常。

解决方案

我发现这个错误也会存在于你在CSS中使用margin auto 。

例如,在固定宽度&中心对齐的布局,其典型使用边距:0px自动;保持内容的中心。这似乎产生了可能的(可能的)十进制左/右边距的内容。这对Firefox来说并不是一个问题..它处理十进制像素偏移就好了。 但是,当他们的对象容器被定位为小数像素值时,Flash小部件总是显得很怪异。至少,您不能与允许按钮进行交互。对我来说,这似乎是这个错误的根本原因,你会看到很多人广泛报道(因为它与FF atleast)。

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



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

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

函数repositionContentContainer(){
//这个例程是一个完全的黑客工作周围的Flash允许按钮错误
if($(#content)。length > 0){

//调整#content左边距,因为默认情况下它可能不是int
setLeftMargin();
//如果用户调整窗口大小,调整#content左边距
$(window).bind(resize,function(){setLeftMargin();});



函数setLeftMargin(){
var newWindowWidth = $(window).width();
var mainWellWidth = $(#content)。width();
//创建一个基于整数的left_offset数字
var left_offset = parseInt((newWindowWidth - mainWellWidth)/2.0);
if(left_offset< 0){left_offset = 0; }
$(#content)。css(margin-left,left_offset);
}


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?

EDIT: 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.

解决方案

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

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.

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).

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?

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天全站免登陆