HTML5: Detecting if you’re on mobile or pc with javascript? [duplicate]

I was looking into this a few years back. In short, you can’t do this with 100% reliability. There seem to be 2 approaches commonly used to provide a ‘best-guess’: 1. User Agent Detection This is where you check what the client is claiming to be. e.g. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { // is mobile.. … Read more

Media queries and background images

According to this test: If you want only the desktop version of the image to be downloaded on the desktop… and only the mobile image to be downloaded on the mobile device – You need to use a min-width declaration to specify a minimum browser width for the desktop image… and a max-width for the … Read more