Really like the idea of having the option of a page redirect blocking old versions of browsers & OSes built in to core Moodle.
@Danny how would one go about doing this in the theme/
Really like the idea of having the option of a page redirect blocking old versions of browsers & OSes built in to core Moodle.
@Danny how would one go about doing this in the theme/
In the theme layout files - something along the lines of (extracted from Julian's Essential theme):
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$checkuseragent = $_SERVER['HTTP_USER_AGENT'];
}
// Check if IE7 browser and display message
if (strpos($checkuseragent, 'MSIE 7')) {
do something for IE7 here
}
if (strpos($checkuseragent, 'MSIE 8') || strpos($checkuseragent, 'MSIE 7')) {
do something for IE 7&8 here
} else {
do something for every other browser here
} ?>
of course the $checkuseragent can be used for just about anything if you know what strings to look for - other versions of IE, versions of other browsers, mobile browsers etc.
Richard
Hi Richard,
For the record, we do have a function in lib/moodlelib.php called check_browser_version() which can be called as:
if (check_browser_version('MSIE') && !check_browser_version('MSIE', 9)) { // This is IE with a version number lower than 9 }
It checks for a version greater or equal to the one specified - hence, first checking for an IE match, and then checking whether it is not greater than or equal to IE9. This attempts to handle various IEisms like different browser modes for infranet sites.
Andrew
Thanks for that Andrew
Hi Alistair.
I question the practice of blocking old versions of anything. Surely the fact that bugs and errors will progressively break a users experience the more out of date their software becomes is bad enough for the end user without being directly disenfranchised by the page they are trying to view?
By all means inform a user their stuff is old and provide a link on how to fix it but I thought blocking users because of their browser, began dying off sometime in the middle of the last decade because it smacks of elitism and punishes the less technically adept. YMMV.
Cheers, Sam.
I totally agree. The only thing we are saying is that we will not be testing things on old browsers, not that we are purposefully breaking anything. I imagine the degradation will be quite gradual for anyone stuck on an old browser for whatever reason.
But discussion continues here: MDL-41973