Firefox extension that detects or monitors a page for certain text and then redirects

2

I'm looking for a Firefox add-on that can detect or monitor a webpage for certain text or words and redirect to another predetermined page if found.

So basically, when someone surfs the web, and they stumble upon a site that contains a particular text or phrase, such as "enemy", the extension will pick up on that and redirect to another page, say example.com.

karikari

Posted 2009-12-28T01:21:14.890

Reputation:

1I fail to see how this idea can end well. – Brian Postow – 2010-05-12T21:45:56.030

I don't really understand what you want. You want to detect text and when you see this text, instead of displaying the page, you want to display a different page? Can you explain what it's for? Is it for an internet filter / Net Nanny? – Mark Byers – 2009-12-28T01:27:10.983

ok. the thing is like this. when someone surf the web, suddenly stumble upon a site that contains a particular text. then, the firefox extension will detect the text and redirect to other preset page. – None – 2009-12-28T02:30:30.257

Answers

2

Compile following javascript in greasemonkey compiler here - http://arantius.com/misc/greasemonkey/script-compiler, you will get firefox extension, and when you install it, it will redirect to google.com when the text "ENEMY" is in the innerHTML. modify those depends on your needs.

// ==UserScript==
// @name           test
// @namespace      test
// @include        *
// ==/UserScript==

(function check(){
    if(/ENEMY/i.test(document.body.innerHTML))
        location.href="http://google.com";
    t=setTimeout(check,500); //check every 500 ms
})();

YOU

Posted 2009-12-28T01:21:14.890

Reputation: 516

This question was migrated from Stack Overflow, but looking at your answer (pure code) makes me thinking, if it actually shouldn't be migrated back there! :> Great answer anyway! – trejder – 2015-11-29T16:02:47.083