Actions

Widget

DeviceType: Difference between revisions

From OSE

No edit summary
No edit summary
Line 1: Line 1:
<div id="device_sizing">
    <!-- Placeholder for the widget content -->
</div>
<script type="text/javascript">
function getDeviceType() {
function getDeviceType() {
         const userAgent = navigator.userAgent.toLowerCase();
         const userAgent = navigator.userAgent.toLowerCase();
Line 8: Line 13:
     return 'desktop';
     return 'desktop';
   }}
   }}
</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>