Skip to content
Snippets Groups Projects
index.html 1.98 KiB
Newer Older
Clément's avatar
Clément committed
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.includes,Array.prototype.find"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
Clément's avatar
Clément committed
  </head>
  <body>
    <script>
      document.addEventListener("DOMContentLoaded", event => {
          if ((window.navigator.userAgent.indexOf("MSIE ") > -1 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) ||
              window.navigator.userAgent.indexOf("Edge/") > -1) {
              Swal.fire({
                  title: 'Please update your browser.',
                  html:
                      'Please either update your Edge browser to the last version' +
                      '(you will find the last update here: <a href="https://www.microsoft.com/en-us/edge" target="_blank">https://www.microsoft.com/en-us/edge</a>)' +
                      ' or switch to another browser (Chrome / Safari / Firefox)',
                  showCloseButton: true,
                  showCancelButton: true,
                  focusConfirm: false,
                  icon: 'warning',
                  confirmButtonText: 'Close now'
              })
          } else {
            //Language given in translation
            const langs = ['fr', 'en', 'it'];
            const defLang = 'en';
            //Get the favorite language of the user's navigator
            const userLangs = (navigator.languages || [navigator.language]).map(
              function (a) { return a.split('-').shift() }
            );
            userLangs.push(defLang);
            const selectedLang = userLangs.find(function(lang) { return langs.indexOf(lang) !== -1 });
            //Redirection to the appropriate index.html
            document.location.replace(selectedLang);
          }
      });
Clément's avatar
Clément committed
    </script>
  </body>
</html>