Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
How i can check a user getting banned?

My html doesn't work. I wanna checking user are banned or not then i used:

<html>
<head style="background-color:#171745"> 
      <style>
      h1 {
      color:white;
      }
      h3 {
      color:white;
      }
      h5 {
      color:gray;
      }
      p {
        color:white;
      }
      </style>
  </head>
  <body>
  <script>
    function checkCookie() {
    let ban = getCookie("banned");
    if (ban != "1") {
    alert("You are banned.");
    } else {
    window.location.replace("https://tuan-os.github.io/home")
    alert("Welcome");
  }
}
  </script>
  </body>
</html>

The user are banned will get a message say him are banned. The not banned user is redirect to tuan-os.github.io/home. But when i test it then the front my eyes is a blank and it no redirect like i think. And i wont the cookie is not detected by the verification....

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

First of all, you are not calling the function:

<script type="text/javascript">
  function getCookie(name) {
    const value = `; ${document.cookie}`;
    const parts = value.split(`; ${name}=`);
    if (parts.length === 2) return parts.pop().split(";").shift();
  }
  function checkCookie() {
    let ban = getCookie("banned");
    if (ban != "1") {
      alert("You are banned.");
    } else {
      window.location.replace("https://tuan-os.github.io/home");
      alert("Welcome");
    }
  }
  checkCookie(); // You should always call the function after creating
</script>

Secondly, there is no getCookie function by default. You should create one using the script like below if you want to get a cookie stored in the browser:

function getCookie(name) {
  const value = `; ${document.cookie}`;
  const parts = value.split(`; ${name}=`);
  if (parts.length === 2) return parts.pop().split(";").shift();
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda