Possible Duplicate:
Permission Denied IE iFrame
Access parent document from dynamic iframe using jquery
I am trying to access the parent document from a dynamic <iframe>
child using $('#_hf_iFrame', top.document)
. It works in Firefox, Chrome and Safari but IE throws an Access Denied exception.
I am using following code to create the <iframe>
dynamically.
This question is continuation of this question. I use the following code to append the dynamic to the document.
var _hf_iFrame = document.createElement("iframe");
_hf_iFrame.setAttribute("id", "_hf_iFrame");
_hf_iFrame.setAttribute("name", "_hf_iFrame");
_hf_iFrame.setAttribute("allow-transparency", true);
_hf_iFrame.setAttribute("style", "height: 354px; width: 445px; border: 0; top: 23%; position: fixed; left:0; overflow: show; background:transparent;");
document.body.appendChild(_hf_iFrame);
_hf_iFrame.setAttribute("src", "javascript:false");
var myContent = '<!DOCTYPE html>'
+ '<html><head><title></title><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script><script type="text/javascript" src="http://somedomain.com/js/core.js"></script></head>'
+ '<body style="margin: 0px;"></body></html>';
_hf_iFrame.contentWindow.document.open('text/html', 'replace');
_hf_iFrame.contentWindow.document.write(myContent);
_hf_iFrame.contentWindow.document.close();
How can I solve this?