Lesson Code: http://www.developphp.com/video/JavaScript/How-to-Detect-User-Browser-JavaScript-Tutorial
Learn how to detect the user browser software using JavaScript. There are various different ways to go about obtaining the result. This script is written to best convey the logic to someone new to programming. We also make special considerations for modern versions of Internet Explorer browser detection in this exercise.
Original source
Kamal Dhariyal
Hi… Are you there… Please provide me your mail id so that i can contact you… I want to have an script and am not getting it.
Please Help…
Legendary Power
Worked excellent for firefox , chrome,Internet Explorer but not with edge it is saying chrome whenever i run the page i don't why please help me
Pouya Vagefi
I open the file on Opera and it detects wrongly Chrome!
raymond deloso
Are you using php framework?
Rahul Agarwal
Hey is there any way to detect users internet speed using php or JavaScript and then display the website accordingly . I mean for 3g or WiFi users there will be videos and animations in the website but for 2g users or slow connection there will be text and static images. I hope u get my question. Please help me find the solution .
Carlos
"I think is a hobby…", you're totally right!!
Salah Bedeiwi
Thanks Adam a lot
Just noticed something:
for instance: if you lowercase this array. say i lower case c in Chrome, it reads safari instead
var ba = ["chrome","Firefox","Safari","Opera","MSIE"]
Nagasatish Aisethy
Thank You..great job.
Kesc777
Tried, didn't work properly, still didn't detect Edge and Vivaldi. Here is my suggested fix:
//…/
var ba = ["Vivaldi", "Trident", "Edge", "Chrome", "Firefox", "Safari", "Opera", "MSIE"];
//…/
Hope it will be helpful.
creativeclerk
I like this because I love logic. And also, DOWN WITH INTERNET EXPLORER!
Mohamed Lamine Toure
Hello, teacher. I'm french and I don't understand well Inglish. There is a french version of this course? PLEASE!!!
yasoo khairy
can i download your videos
LuqMaN AFridi
great job sir Adam Khoury
TechKErala
WTF? this is from Edge 😀 — User-agent header sent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Tyler Obier
Thank you so much Mr.Khoury, you are a life saver! Also thank you for the work and time you devoted to this video.
Adnane AMEZIANE
you're awesom brother , you helped me a lot 😀 tnx
ochiorbus
I recomand everyone try using a browser detection method based on feature detection.
Juan Patiño
I want to warn the user that a mavigator versión is not working with mi web page. How to do it?
Juan Patiño
I want to warn the user that a mavigator versión is not working with mi web page. How to do it?
Umar Baba Jidda
Nice vid. Again. But when does the the kid takeover from you.
MrShawnlloyd
Pretty nifty!
NiceTubeAccount
This digression about Microsoft was hilarious 🙂
Sidharth Gupta
nice tutorial sir , i like to have some light on detecting bots which visiting my site using php
Lemmings
How does this compare to something like Modernizr?
Benjamin Hoey
thanks!
João Ferreira
I'd choose:
ba.some( function( browser ) {
if ( ua.indexOf( browser ) > -1 ) {
b = browser;
return true;
}
});
Or:
b = ba.filter( function( browser ) {
return ua.indexOf( browser ) > -1
})[0];
Or maybe even .reduce()
Troll Troll
Wait, I know in THIS tutorial it does not matter, but what editor do you use?
Julio Vergara
Good video and funny joke about Microsoft…thanks
Dridor
thanks brother
Cornbane
Just to test, I put the more common browsers like Chrome and Firebox at the end of the array and got some interesting results.
Edge and Chrome will return Chrome or Safari depending on which is earlier in the array.
Would Safari return only Safari and thus we have Chrome at the beginning to negate the mix-up?
Adam Khoury
Here is a PHP tutorial of doing something similar:
https://www.developphp.com/video/PHP/Browser-and-Operating-System-Detect-Array-Script