How to detect my browser version and operating system using JavaScript?

后端 未结 10 950
天命终不由人
天命终不由人 2020-11-22 06:25

I have tried using the code below but it only display results in Chrome and Mozilla not working in IE6.

10条回答
  •  情话喂你
    2020-11-22 07:13

    To get the new Microsoft Edge based on a Mozilla core add:

    else if ((verOffset=nAgt.indexOf("Edg"))!=-1) {
     browserName = "Microsoft Edge";
     fullVersion = nAgt.substring(verOffset+5);
    }
    

    before

    // In Chrome, the true version is after "Chrome" 
    else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
     browserName = "Chrome";
     fullVersion = nAgt.substring(verOffset+7);
    }
    

提交回复
热议问题