I'm currently trying to load a page inside a subdomain into my main domain using an iframe, and call the javascript function (when dom-ready) in my main domain so that the main domain can resize the iframe to fit the height of the content. Here is an example
www.mysite.com (code inside the page):
<script type="text/javascript">
document.domain = "mysite.com";
function doSomething() {
}
</script>
<iframe id="mytestid" src="test.mysite.com" height="0" width="900"></iframe>
And for my other site, test.mysite.com, here is the code inside the page:
<script>
document.domain = "mysite.com";
$(document).ready(function () {
window.parent.doSomething();
});
</script>
This seems to be great for firefox, safari and chrome, but not for IE8. When making a callwindow.parent.doSomething()
IE8 always gives me an errorI could not test IE7 or IE6 to find out if the problem persists, but has anyone encountered this problem? Am I missing something with the way I set out the code?
Thanks for helping the guys.