问题描述
背景页面和弹出页面之间有什么区别?
什么是内容脚本?
Chrome扩展程序有许多不同的术语,可能看起来很相似。我会尽我所能来澄清这些条款:
后台页面:基本上是一个在应用程序后台运行的页面,不显示任何内容。该页面将被授予您在清单文件中请求的每个权限。它应该用于访问核心功能,例如将内容添加到上下文菜单,阅读收藏夹,显示浏览器/页面操作。
$ b
弹出页面:名称全称,它创建一个弹出页面。其中一个特殊之处在于,它会在页面上看起来像一个泡泡。如果某个功能与任何特定网址无关,这可能会非常有帮助。与背景页面一样,弹出页面将被授予所需的所有功能。
内容脚本:内容脚本基本上是一个脚本,您可以注入当前页面。尽管您无法直接访问自定义变量,但您可以更改任何页面的DOM和行为以添加功能。注意:您必须对每个注册内容脚本的域请求权限。
为了让您入门,我建议您遵循本教程:
几乎所有您需要了解的关于Chrome扩展开发的知识都已经记录在。作为Chrome扩展开发人员,我发现它非常易于使用并且是最新的。
What is the difference between a background page and a popup page?
What is a content script?
Chrome extensions have many different terms that may look like similar. I will do my best to clarify those terms:
Background page: Basically a page that runs in background of the application, without displaying anything. The page will be granted every permissions you have requested in the manifest file. It should be used to access core-features as adding items to the context menu, read favorites, display a browser/page action.
Popup page: The name says it all, it creates a popup page. One particularity is that it will look like a "bubble" over the page. It can be quite helpful if a feature is not related to any specific url. Like the background page, the popup page will be granted every features requested.
Content script: A content script is basically a script that you can inject in the current page. Althought you cannot access custom variables directly, you may alterate the DOM and behavior of any page to add features into it. Note: you must request permissions on every domains on which a content script is injected.
To get you started, I would advise you to follow this tutorial:
Getting Started: Building a Chrome Extension
Almost anything you need to know about chrome extension development is already documented here. As a chrome extension developer, I find it really easy to use and up to date.
这篇关于背景页面和弹出页面有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!