【问题标题】:jQuery BBQ - "Access Denied" in IEjQuery BBQ - IE 中的“访问被拒绝”
【发布时间】:2012-03-13 08:24:17
【问题描述】:

我在 IE7 和 IE8 兼容模式下遇到了 jQuery BBQ 的问题。

history_set = function( hash, history_hash )

var iframe_doc = iframe.document, //this is the line that the error reports

domain = $.fn[ str_hashchange ].domain;`

我在上面标记的行上收到“拒绝访问”。

我听说这可能是由于 iframe 存在域问题,所以我设置了

document.domain = "mydomain.com";

但仍然发现问题。

帮助?

【问题讨论】:

    标签: jquery hash hashchange jquery-bbq


    【解决方案1】:

    好的,对于收到此错误的其他人,我们就是这样修复它的。

    首先,在 Ben Alman 的建议下,我们对插件进行了一行更改。在 iframe 附加到窗口的地方,.contentWindow 我们更改为.document

    我们还需要使用空白的html文件,并设置源:

    //set iframe src file, will not work in IE7 & compat modes without
                jQuery.fn.hashchange.domain = document.domain;
                jQuery.fn.hashchange.src = 'blank.html';
    
                //Initialize our BBQ
                         blah blah blah
    

    通过这些更改,一切都按预期进行。

    【讨论】:

      【解决方案2】:

      这里的答案对我不起作用,但这里有一个示例实现: http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/

      document.domain 需要在 jQuery 加载之前设置,并且必须与 hashchange.src 文件中的 document.domain 设置相匹配。

      【讨论】:

        猜你喜欢
        • 2011-09-26
        • 1970-01-01
        • 1970-01-01
        • 2012-05-15
        • 1970-01-01
        • 1970-01-01
        • 2011-07-02
        • 1970-01-01
        • 2013-12-20
        相关资源
        最近更新 更多