var ua = navigator.userAgent; var result = document.getElementById('result'); result.innerHTML = ua + "<br>"; if( ua.search(/Android 2.1/) != -1 ) { result.innerHTML += "Android 2.1"; } else if( ua.search(/Android 2.2/) != -1 ){ result.innerHTML += "Android 2.2"; } else if( ua.search(/Android 2.3/) != -1 ){ result.innerHTML += "Android 2.3"; } if( ua.search(/Android/) != -1 ){ result.innerHTML +=
![AndroidのOSのバージョンを取得 - jsdo.it - Share JavaScript, HTML5 and CSS](https://cdn-ak-scissors.b.st-hatena.com/image/square/e09f82110cfc673141d5ce1db62d34078009ef99/height=288;version=1;width=512/http%3A%2F%2Fjsdo-static-contents.s3.amazonaws.com%2Fimages%2Fcapture%2Fx%2Fb%2FK%2FxbKh.jpg%3Ft%3D1312964186)