Millisecond Forums

How to prevent participants from running an Inquisit experiment on mobile devices?

https://forums.millisecond.com/Topic37154.aspx

By Tahwan - 2/18/2025

Hi everyone,

I am trying to prevent participants from running my Inquisit experiment on mobile devices (e.g., smartphones running Android or iOS). I initially tried the following code:

<expt>
/onexptbegin = [
if (computer.os = "ios") script.abort(true);]
</expt>


However, I get the error message: 'computer.os' The expression attempts to set the value of a read-only property.

What would be the correct way to check the operating system or device type and terminate the experiment if it's running on a mobile device? I only want participants to do the script on a regular computer.

Thanks in advance for your help!
By Dave - 2/18/2025

Jakob - 2/18/2025
Hi everyone,

I am trying to prevent participants from running my Inquisit experiment on mobile devices (e.g., smartphones running Android or iOS). I initially tried the following code:

<expt>
/onexptbegin = [
if (computer.os = "ios") script.abort(true);]
</expt>


However, I get the error message: 'computer.os' The expression attempts to set the value of a read-only property.

What would be the correct way to check the operating system or device type and terminate the experiment if it's running on a mobile device? I only want participants to do the script on a regular computer.

Thanks in advance for your help!

You are using the wrong operator. You are trying to set the computer.os property to the value "ios". That cannot work, it's read-only. "=" is the assignment operator. What you need is "==", the logical comparison operator.

https://www.millisecond.com/support/docs/v6/html/language/expressions/operators.htm
By Tahwan - 2/18/2025

Thanks. That is an easy fix!