在加载页面的所有元素之前加载Chrome扩展程序 [英] Load Chrome extension before loading all elements of the page

查看:255
本文介绍了在加载页面的所有元素之前加载Chrome扩展程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在加载网页的所有元素(而不是之后)之前加载我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆