Hi, need help here. I don’t know how to code, yet I am trying the codes below from StackOverflow.
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
iosPlatforms = ['iPhone', 'iPad', 'iPod'],
os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = 'Mac OS';
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = 'iOS';
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = 'Windows';
} else if (/Android/.test(userAgent)) {
os = 'Android';
} else if (!os && /Linux/.test(platform)) {
os = 'Linux';
}
return os;
}
alert(getOS());
How can I put it in bubble so I can get the return vale? I tried to use toolbox plugin to add expression and put the codes above. When I put that, my browser alerts me on page load regarding the OS. However, I want to be able to get the value and put it in a text element. How can I “get” the value of that?
Sorry, I’m a no-code guy. Thanks!