From eb1646ee3b9e8a4d9d47ab83b2045510ba1850b1 Mon Sep 17 00:00:00 2001 From: Florent Poittevin <florent.poittevin@unige.ch> Date: Wed, 30 Oct 2019 16:18:34 +0100 Subject: [PATCH] feat: 890 avoid IE or Edge to access to the app and display a message --- src/index.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/index.html b/src/index.html index 5a54560c2..56ca0ada6 100644 --- a/src/index.html +++ b/src/index.html @@ -22,5 +22,34 @@ <body> <dlcm-root></dlcm-root> <noscript>Please enable JavaScript to continue using this application.</noscript> +<script> + // alert("Utiliser navigateur décent") + var ua = window.navigator.userAgent; + + var browserUnnsuported; + var msie = ua.indexOf('MSIE '); + if (msie > -1) { + // IE 10 or older => return version number + browserUnnsuported = "Internet Explorer " + parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); + } + + var trident = ua.indexOf('Trident/'); + if (trident > -1) { + // IE 11 => return version number + var rv = ua.indexOf('rv:'); + browserUnnsuported = "Internet Explorer " + parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); + } + + var edge = ua.indexOf('Edge/'); + if (edge > -1) { + // Edge (IE 12+) => return version number + browserUnnsuported = "Edge " + parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + + if (browserUnnsuported) { + alert("Your browser " + browserUnnsuported + " is not supported by this application.\nPlease use a browser more recent like Chrome or Firefox."); + document.body.style.display = "none"; + } +</script> </body> </html> -- GitLab