在加载页面的所有元素之前加载Chrome扩展程序 [英] Load Chrome extension before loading all elements of the page
问题描述
我想在加载网页的所有元素(而不是之后)之前加载我的Chrome扩展程序。这可能吗?感谢!
I would like to load my Chrome extension before all the elements of the page load (instead of after). Is this possible? Thanks!
推荐答案
如果扩展名是指内容脚本,那么您可以做的最多的是设置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.
这篇关于在加载页面的所有元素之前加载Chrome扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!