+ 2

how to detect if the user using android mobile by javascript ?

hi guys i need the script to detect the browser if it is an android browser with screen size, by using javascript to make it as a condition for using some modification on my page.

19th Jul 2017, 2:20 AM
Chemseddine Zara
Chemseddine Zara - avatar
3 Answers
+ 4
What kind of modification do you have to handle? Maybe you can use Css media query instead, or just test if the needed JS API/function exists (not 'undefined') ^^
19th Jul 2017, 6:14 AM
visph
visph - avatar
+ 3
include Forest-4x02.js (Or say in another word "my Library" LoL) <script src="https://drive.google.com/uc?export=view&id=0B-32dGkdy2FRb1d3cnc0YkV3M3M"></script> <script> alert(ngt.isUserOnPhone);//This gonna alert true if user currently on mobile </script> or if check only android <script> alert(navigator.userAgent.toLowerCase().indexOf('android')>-1) </script>
19th Jul 2017, 3:03 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 1
#visph yes i'll use css modification but the condition is : if it is an android phone and it's not the the specific browser of my application.
19th Jul 2017, 1:57 PM
Chemseddine Zara
Chemseddine Zara - avatar