diff --git a/js/id/id.js b/js/id/id.js index e83c442c4..e6396b491 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -102,16 +102,29 @@ window.iD = function () { iD.version = '0.0.0-alpha1'; -iD.supported = function() { - if (navigator.appName !== 'Microsoft Internet Explorer') { - return true; +iD.detect = function() { + var browser = {}; + + var ua = navigator.userAgent, + msie = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"); + + if (msie.exec(ua) !== null) { + var rv = parseFloat(RegExp.$1); + browser.support = !(rv && rv < 9); } else { - var ua = navigator.userAgent; - var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"); - if (re.exec(ua) !== null) { - rv = parseFloat( RegExp.$1 ); - } - if (rv && rv < 9) return false; - else return true; + browser.support = true; } + + browser.locale = navigator.language; + + function nav(x) { + return navigator.userAgent.indexOf(x) !== -1; + } + + if (nav('Win')) browser.os = 'win'; + else if (nav('Mac')) browser.os = 'mac'; + else if (nav('X11')) browser.os = 'linux'; + else if (nav('Linux')) browser.os = 'linux'; + + return browser; }; diff --git a/js/id/ui.js b/js/id/ui.js index 768d95813..37874b25f 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -6,7 +6,7 @@ iD.ui = function(context) { history = context.history(), map = context.map(); - if (!iD.supported()) { + if (!iD.detect().support) { container.html('This editor is supported in Firefox, Chrome, Safari, Opera, ' + 'and Internet Explorer 9 and above. Please upgrade your browser ' + 'or use Potlatch 2 to edit the map.')