Email or username:

Password:

Forgot your password?
sam henri gold

BAD GENAI. WE DON’T (bonk) DO (bonk) AGENT (bonk) STRINGS

Google’s code generative AI section for the search “javascript detect trackpad vs mouse”. Its reponse:

"To detect whether a user is using a trackpad or a mouse in JavaScript, you can use the navigator.platform property. The navigator.platform property returns a string that identifies the user's device. For example, if the user is using a trackpad, the navigator.platform property will return the string "MacIntel". If the user is using a mouse, the navigator.platform property will return the string "Windows”.”
9 comments
Mike Beasley

@samhenrigold well now i’m curious… what’s the use case for detecting this difference?

sam henri gold

@MikeBeas Making some adjustments to a horizontal scrolling section so it's easier for mouse use. There does not seem to be any way to detect it outside of some insane check for mouse scroll wheel behavior

Mike Beasley

@samhenrigold ahh i see. yeah i’ve never heard of any way to detect the difference. the trackpad is basically just a mouse to the OS. i know there’s a CSS input type property you can check for touch devices but i don’t think it’ll work for trackpads.

sam henri gold

@MikeBeas Funny, the [pointer media feature](developer.mozilla.org/en-US/do) was the first thing I checked. I guess I could just query for fine and present a lil thing like “Using a mouse? Hold shift to scroll horizontally”

sabik

@samhenrigold @bourgeoibee
As someone pointed out, soon there'll be a whole lucrative line of consulting work where someone wrote a whole system with LLM and now they need help

Григорий Клюшников

If the user is using a text-mode browser, the navigator.platform property will return the string "Linux".

Go Up