0

UPDATE: The problem only occurs in code which uses the "parent." variables. Removing that code fixed the problem:

I'm trying to present an online experiment within an iframe, but whilst the participant can start the experiment, as soon as they go past the first page I get the error:

"Uncaught DOMException: Blocked a frame with origin "https://www.open-collector.org" from accessing a cross-origin frame."

You can see an example of this at:

https://www.open-collector.org/open-streams/rnotebook.php?html_address=https://dl.dropbox.com/s/did85omief3j48o/iframe_in_iframe.html?dl=0

The experiment that the dropbox document (https://dl.dropbox.com/s/did85omief3j48o/iframe_in_iframe.html?dl=0) refers to is also on https://open-collector.org

The code to create the iframe that embeds the dropbox file is:

<iframe id='notebook_iframe'></iframe>

<script>

$.get("https://dl.dropbox.com/s/did85omief3j48o/iframe_in_iframe.html?dl=0",    function(html_data){
    page_content.html = html_data;
    var doc = document.getElementById('notebook_iframe').contentWindow.document;
    doc.open();
    doc.write(html_data);
    doc.close();    

});

</script>

And the code within the dropbox file is:

<iframe id='experiment_1' src='https://www.open-collector.org/badger/sqlExperiment.php?experiment_id=RPDTXczwd6HU5FyG|55&participant=preview' style='width:800px; height:800px'></iframe>

I've read this page but my question involves content that's on the same domain. I've also read this page about pdfs, but I don't think it applies as I'm not writing a pdf into an iframe.

I think the fact that it starts to work, and then stops when the iframe moves to a different webpage within the domain, means that the issue is with changing pages, rather than domain, despite the warning?

p.s. Unfortunately, it is necessary to embed a frame within a frame, in case that's what's exacerbating the problem.

it Haffens
  • 130
  • 13
  • if the error message says that the frame is cross-origin, then the frame is cross-origin - not sure why you'd say it isn't – Jaromanda X Mar 15 '18 at 23:09
  • maybe I'm missing something - cross-origin means from a different domain, right? But the website hosting the frame is from the same domain as the experiment in the iframe (that is within an iframe). – it Haffens Mar 15 '18 at 23:12
  • hmmm, sorry, just looked at the link - I must be missing something too!!! – Jaromanda X Mar 15 '18 at 23:13
  • The only thing that occurs to me is that the "notebook_iframe" (which holds the iframe "experiment_1" doesn't have an explicitly stated source, and so that could be disrupting the awareness that it's all on the same domain...? Assuming the issue isn't that the iframe "experiment_1" changes pages. – it Haffens Mar 15 '18 at 23:23

0 Answers0