Try the following code to redirect as per specific word found:
<pre><script type='text/javascript'>
function redirectURL() {
var specWord = getSpecificWord();
switch(specWord) {
case 'corona':
window.location.replace('corona.html');
break;
case 'covid':
window.location.replace('covid.html');
break;
case 'covid-19':
window.location.replace('covid19.html');
break;
default:
return true;
break;
}
return false;
}
function getSpecificWord(Element) {
var specificWord = "corona";
return specificWord;
}
</script>