Is there a way to change the content in iframe in different primary domain?

<iframe src="http://abc.com/iframe.html" id="iframeId"></iframe>
<body>
<script type="text/javascript" >
    window.onload=function(){
        var aNode = getIframeContent().getElementsByTagName('a');
        for(var i=0;i<aNode.length;i++){
            aNode[i].onclick=function(){
                alert(this.innerHTML);
            };
        };
    };
    function getIframeContent(){  
        var doc;
            if (document.all){
                doc = document.frames["iframeId"].document;
            }else{ 
                doc = document.getElementById("iframeId").contentDocument;
            };
        return doc;
    };
</script>

iframe

<a href="javascript:void(0)">content 1</a>
<a href="javascript:void(0)">content 2</a>
<a href="javascript:void(0)">content 3</a>
<a href="javascript:void(0)">content 4</a>
<a href="javascript:void(0)">content 5</a>

I try some ways, but it doesn’t work.
So I would like to know is there a way?

JavaScript can pass messages between different domains provided that both domains have the necessary JavaScript set up to send and/or listen for messages.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.