Related Experiment Video
Updated: Sep 23, 2025

Enabling High Grayscale Resolution Displays and Accurate Response Time Measurements on Conventional Computers
Published on: February 29, 2012
Precise display time measurement in JavaScript for web-based experiments
Gáspár Lukács1,2, Andreas Gartus3
1Faculty of Psychology, Department of Cognition, Emotion, and Methods in Psychology, University of Vienna, Vienna, Austria. lkcsgaspar@gmail.com.
Abstract:
Conducting research via the Internet is a formidable and ever-increasingly popular option for behavioral scientists. However, it is widely acknowledged that web-browsers are not optimized for research: In particular, the timing of display changes (e.g., a stimulus appearing on the screen), still leaves room for improvement. So far, the typically recommended best (or least bad) timing method has been a single (RAF) JavaScript function call within which one would give the display command and obtain the time of that display change. In our Study 1, we assessed two alternatives: Calling the RAF twice consecutively, or calling the RAF during a continually ongoing independent loop of recursive RAF calls. While the former has shown little or no improvement as compared to single RAF calls, with the latter we significantly and substantially improved overall precision, and achieved practically faultless precision in most practical cases. Our two basic methods for effecting display changes, plain text change and color filling, proved equally efficient. In Study 2, we reassessed the "RAF loop" timing method with image elements in combination with three different display methods: We found that the precision remained high when using either or changes - while drawing on a element consistently led to comparatively lower precision. We recommend the "RAF loop" display timing method for improved precision in future studies, and or changes when using image stimuli. We publicly share the easy-to-use code for this method, exactly as employed in our studies.
Related Concept Videos
Uncertainty in Measurement: Reading Instruments
Measuring Reaction Rates
Setting Time of Cement

