Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from stackoverflow.com Dec 28 '09 at 5:14

This question came from our site for professional and enthusiast programmers.

    
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 Dec 28 '09 at 1:27
    
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. – karikari Dec 28 '09 at 2:30
1  
I fail to see how this idea can end well. – Brian Postow May 12 '10 at 21:45

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
})();
share|improve this answer
    
it works! thanks Mark. – karikari Dec 28 '09 at 3:40
    
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 Nov 29 '15 at 16:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.