iFrame中的内容在Chrome中显示,但在Firefox中不显示

时间:2015-07-21 03:35:58

标签: javascript jquery html css iframe

以下是有关iframe问题的标准问题的答案列表:

  1. 父页面和子页面(iframe中的页面)位于同一个域,子域和目录中。
  2. 没有通过iframe交换的xml,vtt等。
  3. 服务器是S3,CORS已启用,但在这种情况下我认为不重要。
  4. 我有一个通过主页面(父母)访问的测验(子页面)。

    儿童:https://glx.s3.amazonaws.com/ff/jqm.html

    家长:https://glx.s3.amazonaws.com/ff/draft.html

    iframe包含在手风琴中。手风琴,测验,iframe等在Chrome中都功能齐全。在Firefox中,iframe显示没有测验。更奇怪的是,在非常罕见的情况下,测验确实会出现,但一旦刷新就会消失。 我有一个页面的演示没有真正的内容。 iframe以红色文字表示。提前致谢。

    DEMO

    JS :jQuery 2.1.4,jQuery UI 1.11.2,JWPlayer 6.12,jQuizMe 2.2.1

    更新:我不是在考虑这个答案*只是解决我的具体问题。我知道除此之外必须有更多的东西,并且有很多比我更聪明的人有更好的答案。

    *请参阅下面的编辑。

    修改

    4个月后,除了我自己的答案之外没有答案,所以我会自己回答。

1 个答案:

答案 0 :(得分:0)

我发现这个post让我了解了如果Firefox加密网站上的未加密内容,Firefox会阻止iframe内容。但是,我的所有网址都是https,包括iframe的`src'。所以最终我把它缩小到子页面的源头。我在初始化jQuizMe插件时使用了3组选项,而只需要一个。 Firefox混合内容拦截器的严格安全性将我的草率代码视为Mixed Active Content (a.k.a. Mixed Script Content)。因此,我将所有选项放在一组括号中,现在我在使用Firefox时在iframe中有内容。

JS

子页面上的旧JS(jqm.html)

$(function($){
    var options = {
        numOfQuizQues: 12,
        disableDelete: true,
        showWrongAns: true,
        showAns: true,
        review: true
};
    var quiz = {
        multiList: [
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },

            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
        ],

    },
    options = {
        allRandom: true,
        title: ' '
    };
    options.showHTML = true;
    $(".quizArea").jQuizMe(quiz, options);
});

修订JS

$(function($){
    var quiz = {
        multiList: [
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },

            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
            {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
                        {
                ques: "QUESTION?",
                ans: "C",
                ansSel: ["A","B","D","E"]
            },
        ],

    },
    options = {
        allRandom: true,
        title: ' ',
                numOfQuizQues: 12,
        disableDelete: true,
        showWrongAns: true,
        showAns: true,
        review: true,
                showHTML: true
    };

    $(".quizArea").jQuizMe(quiz, options);
});