Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Exclude respondents using mobile devices

Hi, I'm trying to generate an error and prevent respondents from continuing if they are trying to take the survey on a cell phone (tablets are fine).  The code below is generating a string of text at the top of the page and allowing all respondents to continue. Any other ideas?

<span id="err"><h3>Your screen is too small for this survey. Please try again on another device.</h3></span>

<script type="text/javascript">
$(document).ready(function(){
    $('#err').hide();

    var width = screen.width;
    var height = screen.height;
    var cutoff = 480;

    if (width < cutoff || height < cutoff) {
        $('.page').hide();
        $('#err').show();
        $('#prev_button').hide();
        $('#next_button').hide();
        alert('Your screen is too small for this survey. Please try again on another device.');
    }
})
</script>
asked Sep 14 by userlc (195 points)
What version are you using? Lighthouse Studio v9 has a function called ScreenWidth().
Lighthouse Studio 9.3.1
Can you create a page to skip to if the screen width is too small and ask to switch devices, if yes, take them back to the start, if no terminate.
Yes, that is more or less what the above code is meant to do; it's just not working correctly.
Try using window instead of screen:

var width = $(window).width();
var height = $(window).height();
Thanks! Another option is to add the text in the footer rather than the advanced javascript page.

1 Answer

0 votes
We just use something like this in skip logic

ScreenWidth()<760

to send people  to a "screen too small" question

in which we say:

We think your screen width is <b>[%ScreenWidth()%]</b>:

Screenwidths below 760 are too small for this survey - so please re-click the link you were sent using a tablet, or laptop or PC

If the screenwidth displayed above is less than 760 clicking the NEXT arrow will exit you from the survey.

Dan
answered Sep 15 by dan r Bronze (1,550 points)
...