Skip to content
Snippets Groups Projects
index.html 1.88 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">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'
              })
          }
      });

Alice Poggioli's avatar
Alice Poggioli committed
      //Language given in translation
      const langs = ['fr', 'en', 'it'];
Clément's avatar
Clément committed
      const defLang = 'en';
Alice Poggioli's avatar
Alice Poggioli committed

      //Get the favorite language of the user's navigator
Clément's avatar
Clément committed
      const userLangs = (navigator.languages || [navigator.language]).map(
        function (a) { return a.split('-').shift() }
Clément's avatar
Clément committed
      );
Clément's avatar
Clément committed
      userLangs.push(defLang);
      const selectedLang = userLangs.find(function(lang) { return langs.indexOf(lang) !== -1 });
Alice Poggioli's avatar
Alice Poggioli committed

      //Redirection to the appropriate index.html
Clément's avatar
Clément committed
      document.location.replace(selectedLang);
    </script>
  </body>
</html>