且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在加载页面的所有元素之前加载Chrome扩展程序

更新时间:2023-12-05 22:06:22

如果扩展名是指内容脚本,那么您可以做的最多的是设置run_at :document_start清单中的属性意味着
$ b

If by extension you mean content script then the most you can do is set "run_at": "document_start" property in manifest which means


[content script]从CSS,但在任何其他DOM构建或任何其他脚本运行之前。

"[content script] files are injected after any files from css, but before any other DOM is constructed or any other script is run."

(阅读更多)

在页面开始加载之前,您将无法与后台页面进行通信,因为没有同步消息传递。

You won't be able to communicate with your background page before the page starts loading though as there is no synchronous message passing.