Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

320
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda