Userscript to wait for page to load before executing code techniques?

前端 未结 7 2005
迷失自我
迷失自我 2020-11-27 10:24

I\'m writing a Greasemonkey user script, and want the specific code to execute when the page completely finishes loading since it returns a div count that I want to be displ

7条回答
  •  半阙折子戏
    2020-11-27 11:22

    Greasemonkey (usually) doesn't have jQuery. So the common approach is to use

    window.addEventListener('load', function() {
        // your code here
    }, false);
    

    inside your userscript

提交回复
热议问题