Reply To: Embedding HTML

PennController for IBEX Forums Support Embedding HTML Reply To: Embedding HTML

#6531
Jeremy
Keymaster

Did you remove the copy of your HTML file that you had previously uploaded to Scripts? Also make sure that the name of the file you uploaded to Resources is exactly test.html and not, for example, test.html.js or Test.html or test.htm.

There are a few problems with your trial: the command newHtml takes up to 2 arguments maximum, where the first is the name you want to give that element, and the second is the filename of the HTML document you want to include. In the code you posted, you are passing a third parameter, getHtml("test"), which is just a reference to that same element. Also, remember from the tutorial that you need to do things with elements, in particular you need to explicitly tell your script to print them where you want that to happen. Finally, you also want to hold script execution until your participant interacts with the page somehow, for example until they click on a button.

Here’s a possible implementation:

newTrial(
  newHtml("test", "test.html")
    .print()
  ,
  newButton("Continue")
    .print()
    .wait()
)

By the way, I see that your HTML document attempts to include an iframe that points to an external website. This is not recommended, as it can introduce security breaches, or simply not work at all (depending on how browsers handle cross-domain iframes).

Jeremy