what are content scripts in chrome inspector

送分小仙女□ 提交于 2019-12-12 07:46:04

问题


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.


回答1:


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:



来源:https://stackoverflow.com/questions/11911943/what-are-content-scripts-in-chrome-inspector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!