Web application: hide div except android browsers

I developed a mobile web application using the jquery mobile framework ... on my homepage I added a div with some instructions for those who are viewing my Android Android device ...

<div class="instruction"> Some instructions for android users here... </div> 

What is my question, I need this div display only when my website is running an Android browser and browsers, if when starting my website, except for Android browsers, for example: iOs, nokia, etc., you just need to hide this div..This means that this content div allows reading only for those who view my site using Android devices and browsers.

any idea. ?? thanks

+4
source share
2 answers

Use this:

 var agent = navigator.userAgent; var isAndroid = (agent.indexOf("Android") > 0); if (isAndroid ){ $("div.instruction").show(); } 

There are other more accurate ways to detect devices, and you can find them in this answer: What are the available solutions for detecting a browser / mobile phone

JsFiddle working example: http://jsfiddle.net/Gajotres/xHA46/

+3
source

Check the user agent and perform the action -

 if (navigator.userAgent.indexOf('Android') != -1) { $("div.instruction").show(); } 
+2
source

All Articles