Browser.version always returns the same for Android 2-4 #2199

RiZKiT opened this Issue Jan 10, 2012 · 4 comments


None yet

3 participants

RiZKiT commented Jan 10, 2012

There is no way to detect the different Android browser versions. Well, that's a result of the user agent string, but what is a solution?

  1. Fake the browser version and return the Android version instead?
  2. Have something like Browser.Platform.version?
arian commented Jan 10, 2012

It should be possible yes, this is my UA string:

Mozilla/5.0 Linux U Android 2.3.4 en-us SonyEricssonMT15i Build/4.0.2.A.0.42 AppleWebKit/533.1 KHTML, like Gecko Version/4.0 Mobile Safari/533.1

RiZKiT commented Jan 10, 2012

Yes, and a friend send me his user agent string from his Galaxy Nexus, both result in Browser.version == 4.

Mozilla/5.0 (Linux; U; Android 4.0.2; de-de; Galaxy Nexus/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

My problem is, I want to know if i have an Android > 2 browser, because these support position:fixed. For now I check the navigator.userAgent for "Android 2". Maybe i have to deal with it until there is a bulletproof solution to check for position:fixed ... in Modernizr.

arian commented Jan 16, 2012

You should be able to feature test the 'position: fixed', like

function () {
  var container = document.body;
  if (document.createElement &&
      container && container.appendChild && container.removeChild) {
      var el = document.createElement("div");
      if (!el.getBoundingClientRect) {
          return null;
      el.innerHTML = "x"; = "position:fixed;top:100px;";
      var originalHeight =, originalScrollTop = container.scrollTop; = "3000px";
      container.scrollTop = 500;
      var elementTop = el.getBoundingClientRect().top; = originalHeight;
      var isSupported = elementTop === 100;
      container.scrollTop = originalScrollTop;
      return isSupported;
  return null;



We've already marked this as wontfix, and I can't condone UA sniffing. So closing.

@fakedarren fakedarren closed this Feb 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment