js detect mouse support code example Example: js detect mouse support if (matchMedia('(pointer:fine)').matches) { // Device has a mouse }