IF (navigator.userAgent.match (/ (the iPhone | the iPod | the Android | iOS) / I)) { ... // mobile }