if( ! Ext.isIE6 || ! Ext.isIE7 ) {
yourapp.init();
} else {
//show the element that directs people to http://browsehappy.com/
}
How to block access to a site from IE8 or less?
-
30-09-2022 - |
Question
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
Solution
OTHER TIPS
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]);
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.