1var iframe = document.getElementById('myIFrame');
2iframe.contentWindow.body.addEventListener('mouseup', Handler);
3
4function Handler() {
5 alert('works');
6}
1var iframe = document.getElementsByTagName('iframe')[0],
2 iDoc = iframe.contentWindow // sometimes glamorous naming of variable
3 || iframe.contentDocument; // makes your code working :)
4if (iDoc.document) {
5 iDoc = iDoc.document;
6 iDoc.body.addEventListener('afterLayout', function(){
7 console.log('works');
8 });
9};