Actions

Widget

DeviceType: Difference between revisions

From OSE

Created page with "function getDeviceType() { const userAgent = navigator.userAgent.toLowerCase(); if (userAgent.includes('mobile') || userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) { return 'mobile'; } else if (userAgent.includes('tablet')) { return 'tablet'; } else { return 'desktop'; } }"
 
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
function getDeviceType() {
<includeonly>
        const userAgent = navigator.userAgent.toLowerCase();
 
  if (userAgent.includes('mobile') || userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) {
<div id="device_sizing">
    return 'mobile';
    <!-- Placeholder for the widget content -->
  } else if (userAgent.includes('tablet')) {
</div>
    return 'tablet';
</includeonly>
  } else {
    return 'desktop';
  }
}

Latest revision as of 00:37, 31 May 2025