openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4c038a3f89c536f6fd42835074b46fade560aaac
parent 431eef1551bc55158bd78294a570fd218eee268b
Author: dankert <openrat@jandankert.de>
Date:   Fri, 17 Dec 2021 01:27:54 +0100

New: Check if browser has support for ES6-Promises and the fetch API.

Diffstat:
Mmodules/cms/ui/themes/default/script/openrat/workbench.js | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/modules/cms/ui/themes/default/script/openrat/workbench.js b/modules/cms/ui/themes/default/script/openrat/workbench.js @@ -46,6 +46,8 @@ export default class Workbench { */ initialize() { + this.checkBrowserRequirements(); + $('html').removeClass('nojs'); /* Fade in all elements. */ @@ -137,6 +139,33 @@ export default class Workbench { } /** + * Checks the browser requirements for this application. + */ + checkBrowserRequirements() { + + if ( ! window.Promise ) { + console.error('This browser does not support Promises, which is required for this application.' ); + + // Show a little Notice for the user that his shit browser is not supported. + let notice = new Notice(); + notice.msg = 'This browser is not supported'; + notice.msg = 'Promises are not available'; + notice.show(); + } + + if ( ! window.fetch ) { + console.error('This browser does not support the fetch API, which is required for this application.' ); + + // Show a little Notice for the user that his shit browser is not supported. + let notice = new Notice(); + notice.setStatus('error'); + notice.msg = 'This browser is not supported'; + notice.log = 'Fetch API is not available'; + notice.show(); + } + } + + /** * Registriert den Ping-Timer für den Sitzungserhalt. */ initializePingTimer() {