Do you know is it possible by means of bootstrap 3 classes or some other its features to hide some html when there is no mouse at device which is browsing my site?
Asked
Active
Viewed 52 times
2
-
1if you want to use JS, then a possible solution: http://stackoverflow.com/questions/7838680/detecting-that-the-browser-has-no-mouse-and-is-touch-only – K K May 29 '15 at 11:19
1 Answers
0
There are three possible solutions to this, none of which will work completely:
- User agent detection - compile a list of user agents of devices that you know are touchscreen (without mouse) and use
navigator.userAgent
to check if they're being used. This may not work because people can change their user agents in some mobile browsers, and it is almost impossible to find a list of every possible touchscreen user-agent. - Use feature detection libraries like Modernizr. This answer explains it well. However, these detect for touch events, but some desktop browsers have these, so that would tell you something was touchscreen when it wasn't.
- Detect the height and width of the window. Most mobile devices have small screens, but some touchscreen devices (like tablets) can have screens as big as some computers, which means it wouldn't always work. You can use
window.innerHeight
andwindow.innerWidth
(this wouldn't work in IE). You can also use CSS media queries here.

Community
- 1
- 1

hitecherik
- 442
- 2
- 13