Check text on page and if so do something

19/03/2022 18:08:31

  1. // ==UserScript==
  2. // @name Check text on page and if so do something
  3. // @namespace Violentmonkey Scripts
  4. // @include *example.com*
  5. // @grant none
  6. // @version 1.0
  7. // @author -
  8. // @description 19/03/2022 18:08:31
  9. // ==/UserScript==
  10.  
  11. if (/THIS IS AN EXAMPLE OK 10/i.test (document.documentElement.textContent || document.documentElement.innerText) )
  12. {
  13. window.open(document.location.href,"_self");
  14. }
  15.