Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

326
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!