gpt4 book ai didi

JavaScript - Greasemonkey 的工作原理

转载 作者:数据小太阳 更新时间:2023-10-29 04:43:13 27 4
gpt4 key购买 nike

我读了 2005 年写的“Dive into Greasemonkey”(作者 Mark Pilgrim)。它提到 Greasemonkey 将用户脚本包装在匿名函数包装器中。 Greasemonkey 是否将包装器插入源 JavaScript 代码或将其添加为任何事件处理程序,例如 window.onload

最佳答案

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

GM 监听 DOMContentLoaded 事件(基本上是 DOM Ready)here .然后包装用户脚本代码并将其插入沙箱,here .

关于JavaScript - Greasemonkey 的工作原理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3248847/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com