DeviceType: Difference between revisions
From OSE
No edit summary |
No edit summary |
||
| Line 12: | Line 12: | ||
} else { | } else { | ||
return 'desktop'; | return 'desktop'; | ||
}} | }}</script> | ||
</script> | |||
Revision as of 19:55, 30 May 2025
<script type="text/javascript"> 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';
}}</script>