There is window.find()
method doing exactly what you want. It finds a string in window:
if (find(stringToFind)) {
alert('Found');
}
Found string will also be highlighted. This function is supported in all major browsers (IE7+).
https://developer.mozilla.org/en-US/docs/Web/API/Window.find