【问题标题】:Adobe Edge Firefox iframe errorAdobe Edge Firefox iframe 错误
【发布时间】:2015-12-15 20:58:51
【问题描述】:

我有一个使用 Adob​​e Edge 6 的动画。 我正在尝试将动画包含在iframe 中。该代码在ChromeIE 10 上运行良好。但是在 Firefox 上,我在 Adob​​e Edge 库TypeError: C.getComputedStyle(...) is null -> edge.6.0.0.min.js Line-77 上遇到了一个 javascript 错误。

如果我在Firefox 43 上打开动画页面,它运行良好,我只会在将动画包含在iframe 中时收到错误消息。

动画页面:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title>Untitled</title>
    <!--Adobe Edge Runtime-->
    <script type="text/javascript" charset="utf-8" src="/Scripts/edge.6.0.0.min.js"></script>
    <style>
        .edgeLoad-EDGE-1689000111 {
            visibility: hidden;
        }

        div {
            position: absolute !important;
        }
    </style>
    <script>
        AdobeEdge.loadComposition('Test', 'EDGE-1689000111', {
            scaleToFit: "both",
            centerStage: "none",
            minW: "0",
            maxW: "undefined",
            width: "870px",
            height: "350px"
        }, { dom: [] }, { dom: [] });
    </script>
    <!--Adobe Edge Runtime End-->
</head>
<body style="margin:0;padding:0">
    <div id=" stage" class="EDGE-1689000111">
    </div>
</body>
</html>

iframe使用动画页面:

<iframe class="embed-responsive-item" frameborder="0" src="PATH"></iframe>

【问题讨论】:

    标签: javascript jquery html adobe-edge


    【解决方案1】:

    几天前我也遇到过同样的问题。 可能的原因之一是 iframe(或其父节点之一)上的“display:none”规则。即使稍后将“显示”规则设置为“阻止”,这也可能会导致错误。

    这是 bugzilla 的相关问题: https://bugzilla.mozilla.org/show_bug.cgi?id=548397

    您能否检查 iframe(或其父级)在首次出现在 DOM 中时是否有“display:none”?

    现在我们要设置“opacity:0”或“visibility:hidden”而不是“display:none”。

    【讨论】:

    • 是的,父母有“display:none”。此动画位于引导选项卡内。我使用的解决方法(对错误 548397 的评论): if (/firefox/i.test(navigator.userAgent)){ window.oldGetComputedStyle = window .getComputedStyle; window.getComputedStyle = function (element, pseudoElt) { var t = window.oldGetComputedStyle(element, pseudoElt); if (t === null) { 返回 {}; } 其他 { 返回 t; } }; }
    • 当然,如果您可以控制 iframe 代码,这种解决方法会好得多。我的建议是关于外部 iframe 内容的案例(例如,页面上的广告横幅)。您是否在边缘源中找到有关解决此问题的任何信息?谢谢。
    • 很遗憾,我没有找到更好的解决方案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-10
    • 2015-03-14
    相关资源
    最近更新 更多