问题描述
虽然这可能是一件非常基本的事情,但我似乎无法找到答案。我看到很多关于内容脚本
的讨论。当我在 chrome
中打开 web inspector
,并选择 sources
,我看到一个名为内容脚本
的选项卡。我看到一些随机数字和一些脚本,我似乎无法弄清楚它们是什么。 这些如何显示?这些来自哪里?我看不到我的服务器提供这些服务。
在谷歌浏览器中,
While this could be a very basic thing, I can't seem to find an answer to this one. I see a lot of discussion about content scripts
. When I open web inspector
in chrome
, and select sources
, I see a tab called content scripts
. I see a couple of random numbers and a number of scripts and I can't seem to figure out what these are.How are these being shown? where are these coming from? I can't see my server serving any of these.
In Google Chrome, content scripts are JavaScript files that are part of browser extensions. They operate on the web page much like regular javascript does, but from a protected scope (Google calls it an "Isolated World").
Content scripts have a few more privileges than ordinary javascript and, for that reason, content-script JS and page JS cannot ordinarily interact with each other.
When looking at that Content Scripts tab, you will see both the scripts added by any extensions (or by userscripts which are compiled into extensions in Chrome), and also content scripts that are built-in parts of the browser, specifically the API that extensions can use.
You can match extensions to those "random numbers" by opening the extensions tab (chrome://chrome/extensions
), and activating Developer mode
:
这篇关于铬检查器中的内容脚本是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!