Fails to detect iPad Solution

in case you run into the same trouble like me, needing to detect if you are on mobile or not and browserinfo op fails on iPads, here is a possible solution.

the internet says iPads request websites as Desktop by default, rendering the browser info result useless. the copycat code to look if it has touchinput and is a mac indicates an iPad, at least for now. As long as apple doesn’t release a mac with a touchscreen.

image

// outputs

const ipadbool = op.outBool(“isIpad”);

update();

function update()
{
let isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
(navigator.platform === ‘MacIntel’ && navigator.maxTouchPoints > 1)) &&
!window.MSStream

ipadbool.set(isIOS);
}

we decided against this, because this can stop working any time.

there is a is Touchscreen output in “BrowserInfo” op!

with that and another and op you could patch that code easily

didn’t see this, cheers

because its not there


i was looking for something like this but couldnt find it, op-wise

i’d say this is resolved after the August release since browser info op now gives touchscreen info.