Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i detect whether a web user has a software keyboard using javascript?

I'd like to have the search field on my website automatically gain focus when the user loads the page, but i don't like how that pops up the keyboard for users on smartphones/tablets. Is there any javascript property I can use to detect whether or not the user has physical keyboard connected?

like image 477
notatoad Avatar asked Jun 29 '12 20:06

notatoad


People also ask

How do you check if a key is pressed JavaScript?

In plain JavaScript, you can use the EventTarget. addEventListener() method to listen for keyup event. When it occurs, check the keyCode 's value to see if an Enter key is pressed.


1 Answers

I'm not sure about that...but if you check this link out, it'll show you how to detect whether a user is on a mobile platform or not. you could make your decision based on that?

like image 197
PTBG Avatar answered Oct 14 '22 10:10

PTBG