How To Detect Mobile Device By Javascript

How to use Javascript or jQuery to detect if the current device is mobile or not

  • Using Javascript to check if the current device is mobile or not

    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
     // some codes if the current device is mobile
    }
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments