for example, this script will show if specific text on this page.
// ==UserScript== // @name so5059986 // @namespace test // @description test // @include http://stackoverflow.com/questions/5059986/how-to-have-greasemonkey-check-if-text-if-found-on-page // ==/UserScript== var xpathResult = document.evaluate("(//text()[contains(., 'specific text')])[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); var node=xpathResult.singleNodeValue; if (node==null) alert("text not found"); else alert("text found on page");
I do not know what you mean with special tags. The text is always inside some tags.
source share