Actions

Widget

DeviceType: Difference between revisions

From OSE

No edit summary
No edit summary
Line 5: Line 5:
<script type="text/javascript">
<script type="text/javascript">
function getDeviceType() {
function getDeviceType() {
        const userAgent = navigator.userAgent.toLowerCase();
  const userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.includes('mobile') || userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) {
 
    return 'mobile';
  if (userAgent.includes('mobile') || userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) {
  } else if (userAgent.includes('tablet')) {
    return 'mobile';
    return 'tablet';
  } else if (userAgent.includes('tablet')) {
  } else {
    return 'tablet';
    return 'desktop';
  } else {
  }}</script>
    return 'desktop';
  }
}
 
if (getDeviceType() === "desktop") {
        document.write("{{#widget:Iframe|url=https://bnbforms.com/103014/|width=600|height=700|border=0}}");
} else {
        document.write("{{#widget:Iframe|url=https://bnbforms.com/103014/|width=300|height=700|border=0}}");
}
</script>

Revision as of 19:57, 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';
 }

}

if (getDeviceType() === "desktop") {

       document.write("

");

} else {

       document.write("

");

} </script>