Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Browser Support Check

Browser Support Check

Scheduled Pinned Locked Moved The Weird and The Wonderful
javascriptrubyhtmlbusinesshelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    ghaberek
    wrote on last edited by
    #1

    One of our users was sent to a client's site to upload some work files for review. She got a message that said something like:

    This website requires an HTML 4.0 compliant web browser with Javascript enabled. You are using a browser version that does not meet these requirements. It is recommended that you use either Internet Explorer versions 5.5/6.x/7.x, or Netscape version 7.x. Refer to your browser's online help for specific instructions to enable Javascript.

    Yet we are using IE 7 with JavaScript enabled. So I went digging through their page to see what triggered that message and found this little gem:

    function browserSupported()
    {
    var agt=navigator.userAgent.toLowerCase();
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
    var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
    && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
    && (agt.indexOf('webtv')==-1));
    var is_nav62up = (is_nav && (is_major >= 5) && (is_minor >=5) && (agt.indexOf("gecko")!=-1) );
    var is_ie = (agt.indexOf("msie") != -1);
    var is_ie3 = (is_ie && (is_major < 4));
    var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
    var is_ie4up = (is_ie && (is_major >= 4));
    var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
    var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );
    var is_ie55up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5) || is_ie55));
    var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0")!=-1) );
    var is_ie6up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5 && !is_ie55) || is_ie6));
    var is_opera = (agt.indexOf("opera") != -1);
    if (is_nav62up || is_ie55up || is_opera || is_ie6up || is_ie6)
    {
    return true;
    }
    return false;
    }

    Note the complete and utter lack of a check for "msie 7.0", let alone the horrible combination of and's and not's to set all those is_<browser> flags. :doh:

    -Greg

    C C 2 Replies Last reply
    0
    • G ghaberek

      One of our users was sent to a client's site to upload some work files for review. She got a message that said something like:

      This website requires an HTML 4.0 compliant web browser with Javascript enabled. You are using a browser version that does not meet these requirements. It is recommended that you use either Internet Explorer versions 5.5/6.x/7.x, or Netscape version 7.x. Refer to your browser's online help for specific instructions to enable Javascript.

      Yet we are using IE 7 with JavaScript enabled. So I went digging through their page to see what triggered that message and found this little gem:

      function browserSupported()
      {
      var agt=navigator.userAgent.toLowerCase();
      var agt=navigator.userAgent.toLowerCase();
      var is_major = parseInt(navigator.appVersion);
      var is_minor = parseFloat(navigator.appVersion);
      var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
      && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
      && (agt.indexOf('webtv')==-1));
      var is_nav62up = (is_nav && (is_major >= 5) && (is_minor >=5) && (agt.indexOf("gecko")!=-1) );
      var is_ie = (agt.indexOf("msie") != -1);
      var is_ie3 = (is_ie && (is_major < 4));
      var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
      var is_ie4up = (is_ie && (is_major >= 4));
      var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
      var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
      var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );
      var is_ie55up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5) || is_ie55));
      var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0")!=-1) );
      var is_ie6up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5 && !is_ie55) || is_ie6));
      var is_opera = (agt.indexOf("opera") != -1);
      if (is_nav62up || is_ie55up || is_opera || is_ie6up || is_ie6)
      {
      return true;
      }
      return false;
      }

      Note the complete and utter lack of a check for "msie 7.0", let alone the horrible combination of and's and not's to set all those is_<browser> flags. :doh:

      -Greg

      C Offline
      C Offline
      chevu
      wrote on last edited by
      #2

      It seems some rookie has coded that script... :D ;P

      1 Reply Last reply
      0
      • G ghaberek

        One of our users was sent to a client's site to upload some work files for review. She got a message that said something like:

        This website requires an HTML 4.0 compliant web browser with Javascript enabled. You are using a browser version that does not meet these requirements. It is recommended that you use either Internet Explorer versions 5.5/6.x/7.x, or Netscape version 7.x. Refer to your browser's online help for specific instructions to enable Javascript.

        Yet we are using IE 7 with JavaScript enabled. So I went digging through their page to see what triggered that message and found this little gem:

        function browserSupported()
        {
        var agt=navigator.userAgent.toLowerCase();
        var agt=navigator.userAgent.toLowerCase();
        var is_major = parseInt(navigator.appVersion);
        var is_minor = parseFloat(navigator.appVersion);
        var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
        && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
        && (agt.indexOf('webtv')==-1));
        var is_nav62up = (is_nav && (is_major >= 5) && (is_minor >=5) && (agt.indexOf("gecko")!=-1) );
        var is_ie = (agt.indexOf("msie") != -1);
        var is_ie3 = (is_ie && (is_major < 4));
        var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
        var is_ie4up = (is_ie && (is_major >= 4));
        var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
        var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
        var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );
        var is_ie55up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5) || is_ie55));
        var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0")!=-1) );
        var is_ie6up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5 && !is_ie55) || is_ie6));
        var is_opera = (agt.indexOf("opera") != -1);
        if (is_nav62up || is_ie55up || is_opera || is_ie6up || is_ie6)
        {
        return true;
        }
        return false;
        }

        Note the complete and utter lack of a check for "msie 7.0", let alone the horrible combination of and's and not's to set all those is_<browser> flags. :doh:

        -Greg

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        Wow, talk about how times change. I bet I could dig up a curses lib file that does the same thing for DEC VT-xxx terminals. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups