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

321
Vistas
How to go to an a Specific HTML when a word is detected (Java)

Java I made an HTML called hello.html and now I want to use the replace() function in Java to go to the HTML page when the word "Covid" is detected on Google, I tried but it doesn't work for some reason, can you see where I am going wrong, or do I have to change my entire code?

function redirectURL() {
    var specWord = getSpecificWord();

    switch(specWord) 
    {
      case 'corona':
        window.location.replace('hello.html');
        break;
      case 'covid':
        window.location.replace('hello.html');
        break;
      case 'covid-19':
        window.location.replace('hello.html');
        break;
      default:
        return true;
        break;
    }

    return false; // don't let the form submit
}

function getSpecificWord(Element) {
    var specificWord = "corona";
    return specificWord;
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The code does not work since you are not calling the redirectURL function.

Append redirectURL() to your code or use this instead:

(function redirectURL() {
  var specWord = getSpecificWord();
  switch (specWord) {
    case 'corona':
      window.location.replace('hello.html');
      break;
    case 'covid':
      window.location.replace('hello.html');
      break;
    case 'covid-19':
      window.location.replace('hello.html');
      break;
    default:
      return true;
      break;
  }
  return false; //don't let the form submit
})();

function getSpecificWord(Element) {
  var specificWord = 'corona';
  return specificWord;
}
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