Skip to content

Commit

Permalink
Fixed Safari 11 version detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Nov 19, 2017
1 parent a3cae23 commit c94e4cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions DetectRTC.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

// Last Updated On: 2017-11-15 5:25:53 PM UTC
// Last Updated On: 2017-11-19 2:09:51 PM UTC

// ________________
// DetectRTC v1.3.6
Expand Down Expand Up @@ -81,7 +81,7 @@

var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var isFirefox = typeof window.InstallTrigger !== 'undefined';
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var isChrome = !!window.chrome && !isOpera;
var isIE = typeof document !== 'undefined' && !!document.documentMode && !isEdge;

Expand Down Expand Up @@ -128,12 +128,17 @@
// In Safari, the true version is after 'Safari' or after 'Version'
else if (isSafari) {
verOffset = nAgt.indexOf('Safari');

browserName = 'Safari';
fullVersion = nAgt.substring(verOffset + 7);

if ((verOffset = nAgt.indexOf('Version')) !== -1) {
fullVersion = nAgt.substring(verOffset + 8);
}

if (navigator.userAgent.indexOf('Version/') !== -1) {
fullVersion = navigator.userAgent.split('Version/')[1].split(' ')[0];
}
}
// In Firefox, the true version is after 'Firefox'
else if (isFirefox) {
Expand Down
Loading

0 comments on commit c94e4cc

Please sign in to comment.