【问题标题】:Is it possible to get the url of an iframe when the src is https and the parent is http?当 src 是 https 并且父级是 http 时,是否可以获得 iframe 的 url?
【发布时间】:2011-04-18 17:03:49
【问题描述】:

我在 String(u).indexOf() 上收到一个错误,说访问拒绝 http 到 https...所以我认为这不起作用。但也许我错过了什么。

这是在同一个域上,只是协议不同。

  function process_form(f){


    var l = $("iframe#loginFrame");    
    if(l.length==0){      
      f.attr("target","loginFrame");      
      $('<iframe src="/player.htm?ajax=1"'+(!_DBG?' class="hide"':'')+' id="loginFrame" name="loginFrame"></iframe>').prependTo('body');      
      $("iframe#loginFrame").load(function() {
        var u = this.contentWindow.location;


        if(String(u).indexOf("confirm")>=0){ 
          change_form(1);
        }else if(u!=this.src){
          change_form(0);
        }
        log(u);
        log(this.src);

      });



    }else{
      warn("Frame already exists!"); 
    }

    change_form(-1);
    setTimeout(function(){ f.submit();},500);
    log(f);
  }

【问题讨论】:

    标签: javascript iframe https


    【解决方案1】:

    如果您访问不同的域,您确实会遇到 access denied 错误。

    【讨论】:

      【解决方案2】:

      无法从http访问https中的任何信息!

      【讨论】:

        猜你喜欢
        • 2018-12-05
        • 2011-06-26
        • 2013-01-07
        • 1970-01-01
        • 2014-04-17
        • 2015-10-25
        • 1970-01-01
        • 1970-01-01
        • 2019-03-07
        相关资源
        最近更新 更多