0

I'm trying to send a click event to an object/iframe embedded with a cross-domain url, which I also have control over and can add code onto so this should be possible. The reason why I need to do this is because the html page is not running on a conventional web browser but an ar app, which treated the click events kind of differently.

For example, I have tried to do something following the advices from Cross domain iframe issue

<body>
    </div>
    <object id="target" type="text/html" data="www.someurl.com" width="850px" height="820px" style="overflow:auto" class="realityInteraction" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin">
    </object>
    </div>
<script>
// Main page:
window.onmessage = function(event) {
    alert(event.data);
};

document.getElementById('target').contentWindow.postMessage('','*');
</script>

And on the remote url www.someurl.com:

<script>
   window.onmessage = function(event) {
event.source.postMessage(document.body.innerHTML, event.origin);
</script>

It really looks promising but it just does not went through. Maybe I have get something wrong or I have misunderstood some of it. And also the console keep yelling Use of window.alert is not allowed in a sandboxed frame when the allow-modals flag is not set even though I have clearly labeled the iframe/object with the allow-modals flag.

Any assistance is greatly appreciated.

0 Answers0