From eea7aea688f4219f6ab15476312e4f3cd1dd49ac Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 2 Dec 2013 14:18:33 -0500 Subject: [PATCH] Android 2.2 and 2.3: show warning that the browser is not supported --- vendor/assets/javascripts/browser-update.js.erb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vendor/assets/javascripts/browser-update.js.erb b/vendor/assets/javascripts/browser-update.js.erb index 23ff2171d7a..fa03a110fb2 100644 --- a/vendor/assets/javascripts/browser-update.js.erb +++ b/vendor/assets/javascripts/browser-update.js.erb @@ -5,8 +5,20 @@ var $buo = function() { + var badAndroid = false, ua = null; + + // Sometimes we have to resort to parsing the user agent string. :( + if (navigator && navigator.userAgent) { + ua = navigator.userAgent; + } + if (ua && (ua.indexOf('Android 2.2') >= 0 || ua.indexOf('Android 2.3') >= 0)) { + // Android 2.2 and 2.3 browsers report that they have pushState, but they don't really. + // See http://caniuse.com/#search=pushstate + badAndroid = true; + } + // sam: my main concern here is mobile, but its an outlier, for now we support ie9, set conditionally and stuff with pushState - if (window.ie === "new" || (window.history && window.history.pushState)) { + if (window.ie === "new" || (window.history && window.history.pushState && !badAndroid)) { return; }