Example
Jonathan_Hill
9 hours agoSuper Hero
The Construct
Hello! It's surprising - and a little bit troubling - how AI seems to 'get' certain pop culture references in your prompts. Hopefully, this homage is pretty obvious!
The imagery was created...
Jonathan_Hill
9 hours agoSuper Hero
And here's the code I use to detect whether the demo is running on a desktop or mobile device:
function isMobileDevice() {
// Check for mobile-specific user agent keywords
const mobileKeywords = ['Mobi', 'Android', 'iPhone', 'iPad', 'Windows Phone'];
const userAgent = navigator.userAgent;
// Check if any mobile keywords exist in the user agent string
return mobileKeywords.some(keyword => userAgent.includes(keyword));
}
// Check if Storyline's player object is available
if (window.hasOwnProperty('GetPlayer')) {
// Get the Storyline player object
const player = window.GetPlayer();
// Check if the course is being viewed on a mobile device
const mobileView = isMobileDevice();
// Set the 'mobileView' variable in Storyline to indicate if it's a mobile device
player.SetVar('mobileView', mobileView);
}
/*Please ensure you have a True/False variable in Storyline named mobileView*/j
