JAVASCRIPT 33
Browser.js Guest on 2nd August 2020 03:26:10 PM
  1. <script language="javascript">
  2. function WhichBrowser ()
  3. {
  4.     var browsername = navigator.appName;
  5.     var vers = navigator.appVersion;
  6.     var tmp = 0;
  7.     if (browsername == "Microsoft Internet Explorer")
  8.     {
  9.         pos = vers.lastIndexOf('.')-1; // find last period (the dot like in 3.0)
  10.         vers = vers.substring(pos, pos+3); // eliminate everything before pos-1
  11.         tmp = 1; //IE
  12.     }
  13.     else
  14.     {
  15.         pos = 0;
  16.         vers = vers.substring(pos, 4);
  17.         tmp = 2; //Netscape
  18.     }
  19.     // tmp = browsername+' '+vers;
  20.     return (tmp);
  21. }
  22. </script>

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.