Is it possible to detect Android OS (or android web browser) version?

  • Hi,

    If Flash is not supported on Android OS, my client wants to show different
    messages on depending Android OS (or Android web browser version).

    1. If the Android OS version is newer than 2.3 (which means flash is supported)
    and plugin activation is not set to true, then tell the user to set plugin activation to
    "true"

    2. If the Android OS version is older than 2.3 (which means flash is NOT supported),
    then tell the user to upgrade your Android OS.

    Is this possible by modifying "swfkrpano.js"?

    It seems that this is possible using detecting web browser version of Android OS but
    strangely the following link (which shows what browser and version) tells me that
    I am viewing this page on Safari browser (not "Chrome") on my Galaxy S2 Android phone.
    http://www.javascripter.net/faq/browserv.htm

    I thought Google Chrome is the default browser of all Android OS?

    When flash is not supported anymore in the future version of Android OS 5.0 and Flash is
    replaced by HTML5, would this be possible?

    1. If HTML5 is supported, display panoramas with HTML5 krpano viewer.
    2. If HTML5 is not supported but Flash is supported, display panoramas with Flash krpano viewer.
    3. If both HTML5 and Flash is not supported, tell the user to upgrade Android OS.

    PS. Does anybody know when HTML5 krpano viewer for Android OS will be released?

    Best Regards,
    hyung

  • Hi,

    1. If the Android OS version is newer than 2.3 (which means flash is supported)
    and plugin activation is not set to true, then tell the user to set plugin activation to
    "true"

    I'm not sure now if detection the disabled plugin is possible (but I think yes),
    but but the moment the krpano embedding script shows the same message when the Flashplayer is not installed or disabled - it's shows that the Flashplayer is needed,


    2. If the Android OS version is older than 2.3 (which means flash is NOT supported),
    then tell the user to upgrade your Android OS.

    Is this possible by modifying "swfkrpano.js"?

    you could add a simple Javascript like this to get the Android version:

    Code
    var ua = navigator.userAgent;
    if( ua.indexOf("Android") >= 0 )
    {
      var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8)); 
      if (androidversion < 2.3)
      {
    	...
      }
    }

    I thought Google Chrome is the default browser of all Android OS?

    I'm not sure but I think all Webkit based browser have "Safari" in the user agent string,


    When flash is not supported anymore in the future version of Android OS 5.0 and Flash is
    replaced by HTML5, would this be possible?

    1. If HTML5 is supported, display panoramas with HTML5 krpano viewer.
    2. If HTML5 is not supported but Flash is supported, display panoramas with Flash krpano viewer.

    yes (but only when Android is supporting HTML5 one day!)


    3. If both HTML5 and Flash is not supported, tell the user to upgrade Android OS.

    the error-message will be customizable in the next krpano version,


    PS. Does anybody know when HTML5 krpano viewer for Android OS will be released?

    the viewer itself is already Android-ready - the Android detection and the multi-touch events are already Android ready, but the CSS 3D transform are not working correctly on Android at the moment, so a default Android-usage is disabled at the moment,
    it depends on Google when the CSS 3D problems will be fixed, I have reported that issue a dozen times to Google but never got any response...

    best regards,
    Klaus

  • I use something like that, and it works well for me


    <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
    var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
    if (mobile) {

    var userAgent = navigator.userAgent.toLowerCase();
    if ((userAgent.search("android") > -1) && (userAgent.search("mobile") > -1))
    document.write("<div id='mess'>Cette application est incompatible avec <b> ANDROID MOBILE </b></div>");
    else if ((userAgent.search("android") > -1) && !(userAgent.search("mobile") > -1))
    window.location.href="page_tab.html";
    else if ((userAgent.search("blackberry") > -1))
    document.write("<b> BLACKBERRY DEVICE <br>")
    else if ((userAgent.search("iphone") > -1))
    window.location.href="page1_phoni.html";
    else if ((userAgent.search("ipod") > -1))
    document.write("<b> IPOD DEVICE <br>")
    else if ((userAgent.search("ipad") > -1))
    window.location.href="page_padi.html";
    else
    document.write("<b> UNKNOW DEVICE <br>")
    }
    else
    { window.location.href="tour.html";}
    </script>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!