开发者

JavaScript - how Greasemonkey works

I read "Dive into Greasemonkey" (by Mark Pilgrim) written in 2005. It mentions that Greasemonkey wraps a user script in an anonymous function w开发者_如何学编程rapper. Does Greasemonkey insert the wrapper into the source JavaScript code or add it as any event handler such as window.onload?


Does Greasemonkey insert the wrapper into the source JavaScript code or add it as any event handler such as window.onload?

GM listens to DOMContentLoaded event (basically DOM Ready) here. Then wraps the userscript code and inserts that into a sandbox, here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜