if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
// Do something
} else {
// Do something else
}
Dead simple snippet that shows how to detect if user is using a mobile device or a desktop to view your webpage.
#javascript #deviceDetector #mobile
#cesarnog
#javascript #deviceDetector #mobile
#cesarnog
2 Responses
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.