title: Cross domain messaging in Opera Mini
body: <p>I have implemented a cross domain messaging between the main page and an iframe. It works on all browsers except for Opera Mini. </p>
  
  <p>The parent page has the following code:</p>
  
  <pre><code>if (window.addEventListener) {
      window.addEventListener("message", function(event) { alert(event.data);}, false);
  } else if (window.attachEvent) {
      window.attachEvent("onmessage", function(event) { alert(event.data);});
  }
  </code></pre>
  
  <p>The iframe page has this code:</p>
  
  <pre><code>window.parent.postMessage('test', '*');
  </code></pre>
  
  <p>When the iframe tries to access window.parent to execute the postMessage method Opera Mini throws an exception: 'Security error: attempted to read protected variable'. All other browsers will not complain.</p>
  
  <p>See example here: <a href="http://mala.s3-eu-west-1.amazonaws.com/main.html" rel="nofollow">http://mala.s3-eu-west-1.amazonaws.com/main.html</a></p>
  
  <p>Is there a workaround?</p>