[RESOLVED]resize iframe by its content cross domain

this bellow not working in IE please help me i am getting e.data.height= undefined in IE

parent site script—

<script type="text/javascript">
   
    var myEventMethod = 
        window.addEventListener ? "addEventListener" : "attachEvent";
    
    var myEventListener = window[myEventMethod];
  
    var myEventMessage = 
        myEventMethod == "attachEvent" ? "onmessage" : "message";
 
    myEventListener(myEventMessage, function (e) {
       
      if (e.data.message === "setHeight" && e.data.height === parseInt(e.data.height))
            document.getElementById('my-iframe-id').height = e.data.height + "px";
    }, false);
</script>

client side code

<script type="text/javascript">

window.onload = function () {
var returnObj = { message: "setHeight", height: document.body.scrollHeight };
window.parent.postMessage(
returnObj
, "*"
)
};
</script>




This working fine it’s just my mistake

Leave a Reply