Hi everyone,
I'm having a lot of trouble getting cross domain iframe communication working.
It's working on Firefox and Chrome, but on Internet Explorer, it only works in some ways:
If the parent.location = 'new_hash';
is not encompassed in an onClick event, it forces the parent frame to open a new popup window. If it is in an onClick event, the cross domain fragment identifier trick works. What gives?
Sounds like I need to understand javascript..
Edit to comments: parent.location.href and parent.location have the same behavior.
It seems to be my specific browser IE 8.0.7600.16385 reading the hash change as a popup. I'd like to hear if anybody else has experienced something like this.
Creates popup in parent:
<script type="text/javascript">
parent.location = 'http://example.com#new_hash';
</script>
shows a "popup blocked" dialog in IE8. If I let the popups open, they infinitely open popups.
Does not create popup in parent:
<a onClick="parent.location='http://example.com#new_hash'">clicky</a>
or
$(function() {
$("mybutton").click( function() {
parent.location='http://example.com#new_hash';
});
Does not create popup in parent.
My real example
Mine needs the parent.location=newhash to fire when its own hash has a certain value. I essentially have a :
setInterval(function() {
if (location.hash == 'something')
{
parent.location='http://example.com#new_hash';
}
}, 500);
What's going on? How can I tackle this problem? Why does it work when tied to a click event but not if the statement runs on its own? The specific example i'm working on is at http://www.grovemade.com/products/test at v.04
I'm actively messing around here so it may become outdated..
On Firefox and Chrome, the parent frame is modified from no hash, to #xdm-success, to #handshake-complete.
On IE8, #xdm-success forces a new page to open.
Thank you!