Browser version inside unity3d

Are there some way to get browser version inside running c# unity scripts? I.e. i want to check whether Ff, IE, Opera or chrome is currently holding the plugin.

You can use external eval or call

http://unity3d.com/support/documentation/ScriptReference/Application.ExternalEval.html

http://unity3d.com/support/documentation/Manual/Unity%20Web%20Player%20and%20browser%20communication.html

and to call a bit of web page code to detect the browser type

http://www.w3schools.com/js/js_browser.asp

e.g.

<script type="text/javascript" language="javascript">
<!--
function SaySomethingToUnity()
{
    GetUnity().SendMessage("MyObject", "MyFunction", "Browser Version: " + navigator.appVersion);
}
-->
</script>

Hot question today -- this link has all the details of communicating to and from the web player instance.

http://unity3d.com/support/documentation/Manual/Unity%20Web%20Player%20and%20browser%20communication.html

In your case specifically I'd look at

http://unity3d.com/support/documentation/ScriptReference/Application.ExternalEval.html

Grab a basic .js browser Major/Minor version checker from the net somewhere, put that on the same page hosting the player, then call it at runtime.

Since there is no full step by step clear solution, I will post my solution:

  1. Create a BrowserVersion.jslib file inside the Assets/Plugins/WebGL folder. The extension has to be .jslib and not .js so the unityscript compiler does not try to complie it. Inside this file paste this:

    var BrowserVersionPlugin =
    {
    GetBrowserVersion: function()
    {

     var ua = window.navigator.userAgent;
     var tem;
       var M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
    
       var returnString = "test";
    
       if(/trident/i.test(M[1]))
       {
           tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
           returnString = 'IE '+(tem[1] || '');
       }
    
       if(M[1]=== 'Chrome')
       {
           tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
           if(tem!= null) 
             returnString = tem.slice(1).join(' ').replace('OPR', 'Opera');
       }
    
       M= M[2]? [M[1], M[2]]: [window.navigator.appName, window.navigator.appVersion, '-?'];
    
       if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
         returnString = M.join(' ');
     
       var buffer = _malloc(lengthBytesUTF8(returnString) + 1);
       stringToUTF8(returnString, buffer, returnString.length + 1);
         return buffer;
     }
    

    };

    mergeInto(LibraryManager.library, BrowserVersionPlugin);

This is a javascript function that prints something along the lines of “Chrome 40” or “Safari 10”.

  1. Inside the class that you want to make the call declare your function

[DllImport(“__Internal”)]
private static extern string GetBrowserVersion();

  1. Call it in order to get the string version

string browserVersion = GetBrowserVersion ();

Seems important for Chrome. V60 plays animations very jerky. V61 is very smooth.