I’d like to restrict the browser that participants use because my experiment has compatibility problem with Brave and potentially others. I use the code following to trace the browser: psychoJS.experiment.addData(“Browser”, window.navigator.userAgent);
But after testing, it doesn’t correctly distinguish some browsers like Brave. The returned value is the same as Chrome: Brave: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Chrome: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Does anyone any suggestions on how to correctly record the browser participants are using and quit the experiment immediately if certain types of browsers are detected?
Also the size and location of images are not the optimal:In the Begin Experiment phase, I read screen.width and screen.height to arrange three images in a line, adding spacing between them and the screen edges. But in Brave the images align to the edges with no gap.
In Brave: (no space between images on the sides and the screen edges)
However when I tried to put the codes on End Routine of the first routine, the images can not be loaded correctly:
At first I tried to read the screen size with psychoJS.window.size[0] and psychoJS.window.size[1]; but images would align with the edges of the screen somehow. If I read with screen.width and screen.height the images would align correctly with spaces on both sides.