本文介绍了被拒绝访问 IFRAME 中的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jsp页面中有一个链接.

I have a link in my jsp page .

链接看起来像这样

<a href="javascript:doSomething('abc.ff' , 'abc.ff?m=1')">

javascript 代码

the javascript code

    function doSomething(url, url_progress){
    parent.win1.location.href = url;
    /* Wait until something surely has started! */
    window.setTimeout("this.startFinally()", 1000);
    this.startFinally = function (){
    location.href = url_progress;
      }
    }

当用户在此碰杯时一切正常.现在最近我把这段代码放在一个 Iframe 中,然后什么也没发生.我检查了萤火虫并收到此错误:

When the user clinks on this clinks everything works fine. Now recently I put this code inside a Iframe and then nothing happens. I checked with firebug and got this error :

   Permission denied to access property 'win1'
   [Break On This Error] parent.win1.location.href = url;

可能是什么问题?

推荐答案

这可能是 同源政策 的作用.所有内容都来自同一个主机/端口吗?

It's possibly the same origin policy kicking in. Is everything served from the same host/port?

这篇关于被拒绝访问 IFRAME 中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 23:00