【问题标题】:Resizing of iframe with js stops working when https使用 js 调整 iframe 的大小在 https 时停止工作
【发布时间】:2012-06-04 13:26:24
【问题描述】:

我想做的是调整fancybox iframe的大小,我认为我通过调用成功了:

parent.jQuery('#fancybox-inner').css({'height': '450px'});
parent.jQuery('#fancybox-wrap').css({'height': '550px'});

但是当将它部署到我在 https 中工作的舞台区域时,这个解决方案不起作用,我猜它与 https 部分有关。我试图谷歌这个,但我没有找到任何合适的解决方案。可以请帮助我,记住我是一个 JS 新手。

代码:

jQuery().ready(function() {
    jQuery('#no_user').click(function () { 
        if (jQuery(".temp_expand").css("display") == "none") {
            jQuery(".temp_expand").slideDown();
                parent.jQuery('#fancybox-inner').css({'height': '450px'});
                parent.jQuery('#fancybox-wrap').css({'height': '550px'});
            }
            else {
                jQuery(".temp_expand").slideUp();
                jQuery(".temp_expand").css("display", "none");                    
                parent.jQuery('#fancybox-inner').css({'height': '850px'});
                parent.jQuery('#fancybox-wrap').css({'height': '950px'});
            }
            }).toggle(function() {
                jQuery('#temp_no_user').text("#{messages['login']}");
            }, function() {
                jQuery('#temp_no_user').text("#{messages['register']}");
            });           

        });

编辑开始

我收到一个 JS 错误:

Error: Permission denied to access property 'jQuery'
Source File: https://stage.temp.se/login/login
Line: 185

编辑结束

【问题讨论】:

    标签: javascript jquery https


    【解决方案1】:

    听起来您的页面为 https,框架源为 http - 反之亦然。如果是这种情况,这可能会有所帮助:

    Updating a http parent page from a https page via Javascript

    Allowing HTTP iFrame to call JavaScript on HTTPS parent frame

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 2014-04-02
      • 1970-01-01
      • 2014-01-01
      • 2019-05-18
      • 1970-01-01
      相关资源
      最近更新 更多