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 }