2018-03-16 07:58:34 -06:00
|
|
|
function flunk() {
|
|
|
|
// DO NOT USE i18next here.
|
|
|
|
// IE Cannot handle it.
|
|
|
|
const READ_THE_COMMENT_ABOVE = "This app only works with modern browsers.";
|
|
|
|
alert(READ_THE_COMMENT_ABOVE);
|
2019-02-06 19:47:34 -07:00
|
|
|
window.location.assign("https://www.google.com/chrome/");
|
2018-03-16 07:58:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const REQUIRED_GLOBALS = [
|
|
|
|
"Promise",
|
|
|
|
"console",
|
|
|
|
"WebSocket",
|
|
|
|
"Intl",
|
2020-02-28 09:35:32 -07:00
|
|
|
"Set",
|
2018-03-16 07:58:34 -06:00
|
|
|
];
|
|
|
|
|
|
|
|
const REQUIRED_ARRAY_METHODS = [
|
|
|
|
"includes",
|
|
|
|
"map",
|
2020-02-28 09:35:32 -07:00
|
|
|
"filter",
|
2018-03-16 07:58:34 -06:00
|
|
|
];
|
2018-03-15 08:04:21 -06:00
|
|
|
|
|
|
|
/** We don't support IE. This method stops users from trying to use the site.
|
|
|
|
* It's unfortunate that we need to do this, but the site simply won't work on
|
|
|
|
* old browsers and our error logs were getting full of IE related bugs. */
|
|
|
|
export function stopIE() {
|
|
|
|
try {
|
|
|
|
// Can't use Array.proto.map because IE.
|
|
|
|
// Can't translate the text because IE (no promises)
|
|
|
|
for (let i = 0; i < REQUIRED_GLOBALS.length; i++) {
|
|
|
|
if (!window.hasOwnProperty(REQUIRED_GLOBALS[i])) {
|
|
|
|
flunk();
|
|
|
|
}
|
|
|
|
}
|
2018-03-16 07:58:34 -06:00
|
|
|
|
2018-03-15 08:04:21 -06:00
|
|
|
for (let i = 0; i < REQUIRED_ARRAY_METHODS.length; i++) {
|
|
|
|
if (!Array.prototype.hasOwnProperty(REQUIRED_ARRAY_METHODS[i])) {
|
|
|
|
flunk();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Object.entries) { flunk(); }
|
|
|
|
} catch (error) {
|
|
|
|
flunk();
|
|
|
|
}
|
|
|
|
}
|