8

I want to change the script using greasemonkey. But it doesn't work. Please help;

original script

<script>
      function abc(){
          // SOME STUFF HERE
      }
      abc();
      window.onload = abc;
      .....
      // OTHER JAVASCRIPT TASK
      .....
</script>

Now I want to change the function abc as my requirement. I tried the following way but doesn't help.

// ==UserScript==
// @name        Test
// @namespace   UNIQUE_NAMESPACE
// @include     http://PATH_TO_DOMAIN/*
// @version     1
// @grant       unsafeWindow
// ==/UserScript==
unsafeWindow.abc= function () {
    //MY REQUIREMENT
}

1 Answer 1

3

You will find a good example/tutorial here: @document-start Example: hijack page scripts

N.B. The 'beforescriptexecute' event used in this script, which is part of HTML5 specifications, is supported only by Gecko-based browsers (Firefox) at the moment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.