psychopy.org | Reference | Downloads | Github

How to detect people's hardware (e.g., using a pc or a tablet)

URL of experiment:

Description of the problem:
Hi All,
I would like your advise in this topic. We are about to start to run a study online in which we are going to send participants the URL from Pavlovia to go through the tasks. However, as I know there are some compatibility with mobile devices and they are probably the best scenario to perform an experiment either, I wonder if there is a way to know whether they are connecting with a PC/laptop or a mobile device (e.g., cellphone/tablet). If it is not possible, I would also like your advice on how you have deal with this situation.

Thank you,

Hey Roberto :slight_smile:

This isn’t natively part of Pavlovia as far as I know, but in principle you can add custom JavaScript to do this. You can grab a function that returns true/false for either just mobile or mobile and tablet browsers from the top answer here: https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser

Then add it as a code component at the start of the experiment that saves a variable with the relevant info. Then you just need to save that information somewhere, so in the “begin routine” code pane for your first trial, just add a “currentLoop.addData” function call and you should be able to save it to your data file.

EDIT: see also What access we have to the computer (i.e. can we tell which operating system is being used) during the online experiment?

1 Like