Have an idea?

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

Screen width vs window width

In the question "Screen out mobile users?" (asked by John on 4/1/16), Justin offered a solution and called the variable screen_width.  It appears to be window_width rather than for the full screen.  Is there a way to get the width of the full screen?  (Version 8.4.8)

Also, is sys_ScreenWidth available in v8?  Does it return the screen or the window?
asked Feb 16, 2017 by Mike

1 Answer

+2 votes
sys_ScreenWidth returns the width of the window.  It is not built into v8.4.8, but as Justin's code shows, you can achieve the same effect as having sys_ScreenWidth with a simple free format question.

As for reading the screen width, you can store this value with just a slight modification to Justin's code:

<input name="screen_width" id="screen_width" type="hidden" value="">

<script>
$(document).ready(function(){
    $("#screen_width").val(window.screen.width);
})
</script>
answered Feb 16, 2017 by Zachary Platinum Sawtooth Software, Inc. (67,650 points)
...