oTree Forum >

Prevent next page to be opened in new tab/window

#1 by Juanfran

Dear oTree community,

Is there any method to turn off the browser option to open the next page in a new tab/window when clicking a link?
I ask about it because, without that, participants in an experiment could go ahead preserving the previous pages (if not refreshing them) by opening the following ones with a right click in the next button (or center click or pressing the cntrl key), which could be so undesired in many studies. 
I guess one solution would be to change all the oTree {{ next_button }} by HTML buttons and include a JS code that avoids this in that class of buttons (although I haven't done it yet since I don't know how to do that JS part). Still, I wonder whether there is a way to do it for the otree {{ next_button }}.
Moreover, I wonder whether using a JS method to solve this problem could not be enough if the participant has disabled JS in his browser.

Best,

Juanfran

#2 by BonnEconLab

I see your point but wonder whether your solution is worth implementing. If I understand you correctly, your concern is that while making their decisions, participants could look at earlier pages (e.g., previous decisions, feedback on previous decisions, instructions, etc.). Right?

Well, if participants really desire to look at certain pages repeatedly, they can also simply take screenshots of those pages. Hence, your approach of preventing links to be opened in new tabs would not really solve the problem.

That said, one thing that would help is checking via JavaScript whether the current page is the active one in the browser (see, e.g., https://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active) and whether the mouse pointer is inside the active browser window (I have seen an experiment in which this was done to ensure that people remained attentive). This way you could detect whether participants switch to a different browser tab/window or to a completely different program. (Of course, individuals who have JS disabled in their browsers would not be allowed to participate in such a study.)

What you still will not be able to do is to prevent your participants from using a tablet or smartphone for taking photos of their screens’ contents. For this level of control, you will have to set up a video conference with your participants during your experimental sessions.

Alternatively, run an old-fashioned lab experiment. ;-)

Write a reply

Set forum username