I'm trying to find a text on a loaded page and if the text matched then I should get alerted
<script type='text/javascript'>
window.onload = function() {
if ((document.documentElement.textContent || document.documentElement.innerText).indexOf("John") > -1) {
alert("Matched");
}
};
</script>
<body>
<p> Hello! John is here </p>
</body>