Quantcast
Channel: Opera Mini - Opera Forums
Viewing all articles
Browse latest Browse all 859

Cross domain messaging in Opera Mini

$
0
0

I have implemented a cross domain messaging between the main page and an iframe. It works on all browsers except for Opera Mini.

The parent page has the following 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);});
}

The iframe page has this code:

window.parent.postMessage('test', '*');

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.

See example here: http://mala.s3-eu-west-1.amazonaws.com/main.html

Is there a workaround?


Viewing all articles
Browse latest Browse all 859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>