Capturing response times

I have a possible contract for a web app that would require capturing response times in milliseconds to a key being pressed when an image is shown on screen.
This task would be repeated a number of times in quick succession and I wondered if this could be achieved by running the test on the client end using javascript?
I have a feeling that running it from the server side would be too susceptible to latency issues.

Any pointers as to how to go about this would be much appreciated!

It must be done client side in javascript. I don’t know if that rules out Xojo Web or not.

Definitely not possible server side. Latency can go as high as 60 ms.

Quite possible in JavaScript using the events onload for the picture, onkeydown, and the getmilliseconds method.

Then you can use a WebSDK control to get the values back to Xojo.

Thanks Tim and Michel for your replies - I’ll have to take a look at the WebSDK to see what’s possible although my JavaScript skills are not up to much!

  • Create a responseTime window property
var window.startingTime

  • In the image onload event create a new date object, getmilliseconds and affect milliseconds to startingTime

  • In the page onkeydown, create a new date object, getmilliseconds, subtract startingTime, and use WebSDK TriggerServerEvent to send the value back to Xojo.

Alternatively, you can do


And catch that value in Session.HashtagChanged, where you check if HashTag starts with “responsetime:”, and the value is on the right side of the string.

I linked to the excellent w3schools LR pages, where you have very good practical examples.

Many thanks Michel, I will take a look through all those great links.