0

i create a javascript webapp based on Extjs 4.2. A lot of feature of this framework doesn't work correctly with IE8 (and i don't know the result with previous versions). I'm searching the more clean way to block the access of my web app using user agent like IE8 or lesser from displaying a message and avoid the login to the webapp.

Anytype of help is usefull

1
  • 1
    Use conditional statements to display a warning telling users that the site won't work correctly with that browser, don't block them completely.
    – adeneo
    Jan 20, 2014 at 11:29

3 Answers 3

1
if( ! Ext.isIE6 || ! Ext.isIE7 ) {
    yourapp.init();
} else {
    //show the element that directs people to http://browsehappy.com/
}
1
  • probably it's the simplest and most effective way to do that. Thanks for the answer.
    – AfanfeFana
    Jan 20, 2014 at 14:17
1

I wouldn't block access, I would show a message that says features in this application may not function correctly. Denying access is bad. If you want easy IE8 detection checkout Conditionizr and the IE8 detect (I created it):

/*!
 * IE8
 * @cc_on Conditional Compilation to test the
 * JavaScript versions
 */
conditionizr.add('ie8', [], function () {
  var version = false;
  /*@cc_on if (@_jscript_version > 5.7 && !/^(9|10)/.test(@_jscript_version))
  version = true @*/
  return version;
});

This gives you:

if (conditionizr.ie8) {
  // stuff for ie8
}

conditionizr.on('ie8', function () {
  // callbacks
});

Plus you can load polyfills/other assets. Perhaps you can load Ext.js for non-IE8 so that the app doesn't break, it just doesn't serve instead.

With Conditionizr you can ignore browsers too using !:

conditionizr.on('!ie8'[, callback]);
0

Just use one of IE's conditional statements within your markup:

<html>
    ...
    <body>
        <!--[if lte IE 8]>
            <p>Notice: As you are using an old browser some features of this
               web app may not work for you. Please update.</p>
        <![endif]-->
        ...
    </body>
</html>

Anything contained within the <!--[if lte IE 8]> block here targets any version of Internet Explorer less than or equal to IE8.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.