diff --git a/assets/companion.js b/assets/companion.js index 18b96cc..81e54bc 100644 --- a/assets/companion.js +++ b/assets/companion.js @@ -186,7 +186,19 @@ }); } + function isMobileDevice() { + // The companion only ships for Windows and Linux desktops, so skip it + // on phones/tablets. Checks the UA and falls back to "touch is the only + // pointer" so narrow desktop windows still get the companion. + if (/Android|iPhone|iPad|iPod|Mobi/i.test(navigator.userAgent)) return true; + return window.matchMedia('(pointer: coarse)').matches && + !window.matchMedia('(any-pointer: fine)').matches; + } + function init() { + // Every companion element is rendered hidden, so bailing out here + // leaves the status icon and reveal buttons invisible on mobile. + if (isMobileDevice()) return; probeStatus().then(function () { updateFooterIcon(); wireFileLinks();