How to Detect User Browser JavaScript Programming Tutorial

Lesson Code:
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.


32 thoughts on “How to Detect User Browser JavaScript Programming Tutorial”

  1. Hi Adam, thank you for this tutorial, it helps me. I know, its trendy hate big companies like Microsoft, but this is not mistake created by MS. How to improve your code? Simply swap items in your array to 0. position "Edge" and 1. position "MSIE" and all works fine. Regards

  2. Too much talking about nothing… as i listen to you it seems MUCH MORE complicate than it is… Anyway.. thanks for a little reminder how to detect such things.

  3. 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 .

  4. 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"]

  5. 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.

  6. 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

Leave a Reply

Your email address will not be published. Required fields are marked *