After spending way to much time looking for a solution to this, I wound up settling for only identifying desktop/laptop operating systems. As for the mobile platforms, I’ll just plan to not perform some functions on them - either that or I will write scripts that I know will work perfectly on desktop, and just do a Hail Mary for mobile…
In case anybody else is looking for something similar, I’m running the following javascript via Templater to ID the OSs (the iOS channel doesn’t actually do anything, but I’m keeping it for the time being):
/**
* hostname does not require an argument.
* hostname returns the operating system that Obsidian is running on.
*/
function hostname() {
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 (userAgent.indexOf(iosPlatforms)) {
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;
}
module.exports = hostname;