3 Replies
Matthew Bibby

To determine if someone is on a mobile device (i.e. has a touch screen) then you could use this JavaScript:

var hasTouchScreen = false;
if ("maxTouchPoints" in navigator) {
hasTouchScreen = navigator.maxTouchPoints > 0;
} else if ("msMaxTouchPoints" in navigator) {
hasTouchScreen = navigator.msMaxTouchPoints > 0;
} else {
var mQ = window.matchMedia && matchMedia("(pointer:coarse)");
if (mQ && mQ.media === "(pointer:coarse)") {
hasTouchScreen = !!mQ.matches;
} else if ('orientation' in window) {
hasTouchScreen = true; // deprecated, but good fallback
} else {
// Only as a last resort, fall back to user agent sniffing
var UA = navigator.userAgent;
hasTouchScreen = (
/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)
);
}
}
var player = GetPlayer();
player.SetVar("HasTouchScreen", hasTouchScreen);

You'll need a True/False variable in Storyline called HasTouchScreen for this to work.

Here's a demo.

Here's the source file

Nicole Ralph

Wow Matthew!  Thank you for your prompt reply and the code.

Sorry for a silly follow up question, but how/where do I see the results of the trigger?  Is there a report generated someplace?  I must be missing a step/process.

To clarify,  as a course coordinator I'm looking to see overall user stats rather than the user seeing their individual  information reflected back at them.

Thank you again.  Nicole