Mechanical Turk in research: the 3 day bug

Posting this to save the next person a big headache! Xperiment uses External Questions in Mechanical Turk. I gave up trying to use Regular Questions as MTurk kept on scrambling javascript I had included in the page.

When opening a MTurk study using Xperiment, the below message appears (above this message are details about the study etc). The SJ clicks ‘begin’ and the experiment opens up in a new browser tab. After finishing the study, the SJ is given a short code to enter into that box below. If the code is correct, the ‘hit’ is submitted.

Well, that was the plan anyway!

You see, I assumed that as I used ‘External’ hits, I had to submit Hits to the external URL: /mturk/externalSubmit… WRONG!! Although the hits were submitting, the below empty website kept on popping up.  <bean:message key=”external_submit.title”/> (for SEO :).  Note psiTurk open in another tab – an excellent package to help researchers submit their own mturk hits – check it out!).

I tried EVERYTHING to stop this. Making matters worse, I found a solution in Chrome by specfiying the target of the Submit form as a hidden IFrame in my page, but this would not work in Explorer or Firefox. So I spent A LOT TIME battling this apparent across browser incompatibility.

Well, it turns out that that if you submit hits within the iframe provided by mechanical turk (where the above box resides) you submit Hits as you would do if it were a regular Q using this URL: /mturk/submit… OMFG .


Find below too my Javascript function and html form that works. Perhaps it is useful.

function studyCompleted(path) {

form = document.getElementById(‘hitForm’);

//form.action = path+’/mturk/externalSubmit’;

form.action = path+’/mturk/submit’;




if (flashvars.hasOwnProperty(“assignmentId”))     {assignmentId = flashvars.assignmentId;}

if (flashvars.hasOwnProperty(“hitId”))             {hitId = flashvars.hitId;}

if (flashvars.hasOwnProperty(“workerId”))         {workerId = flashvars.workerId;}








<form target=”_parent” name=”hitForm” style=”visibility:hidden” id=’hitForm’ method=”POST”>

<input type=”hidden” id=”assignmentId” name=”assignmentId”>

<input type=”hidden” id=”hitId” name=”hitId” />

<input type=”hidden” id=”workerId” name=”workerId”  />

<input type=”hidden” name=”mock” value=”mock”>

<input type=”submit” name=”Submit” id=”submitButton” value=”submit” disabled=”true”>


Leave a Reply

Your email address will not be published. Required fields are marked *