Lesson Code: http://www.developphp.com/video/JavaScript/How-to-Detect-User-Browser-JavaScript-Tutorial Learn how to detect the user browser software …

source

32 COMMENTS

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

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

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

  4. 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()

LEAVE A REPLY

Please enter your comment!
Please enter your name here