

Users can access the options page in several ways as described in Finding the options page. The options page The options page ( options.html) provides a way for users to customize an extension, such as choosing which sites the extension will run on. When the user navigates away it will automatically close.

Users can easily find it by clicking on the extension toolbar icon. The two most common HTML pages are: The popup Many extensions use a popup ( popup.html) to provide functionality, such as displaying a list of tabs, or additional information regarding the current tab. All extension HTML files can use the Chrome APIs, but cannot include inline Javascript they must point to a JavaScript file. # Extension HTML pagesĪn extension can have different HTML pages depending on the design. See Understanding content scripts for more details. They also have access to a limited number of Chrome APIs. An extension can choose which websites a content script should run on by specifying match patterns.Ĭontent Scripts share access to the same DOM tree as the host page but run in a separate JavaScript environment (the extension's isolated world). Host pages are the websites that a content script interacts with. For example, they can insert a new element on the page, change the style of a website, modify the DOM elements, etc. They allow the extension to interact with and modify pages in the browser.
#CHROME EXTENSION MOUSELESS 2018 CODE#
# Content scriptsĮxtensions use content scripts ( content-script.js) to inject code into host pages. See Handling events in the extension service worker for more details. It also runs in its own environment, so it cannot directly modify a web page's content. For example, the service worker can listen for and react to events when the extension is first installed, a new tab is created, a new bookmark is added, the extension toolbar icon is clicked, etc.Ī service worker can access all the Extension APIs, but as a type of Worker it can't use the DOM APIs that a document's global Window object provides. It is often used to process data, coordinate tasks in different parts of an extension, and as an extension's event manager. # The extension service workerĪn extension service worker ( service-worker.js) is an event-based script that the browser runs in the background. For ready to use code samples, check out the Manifest examples. The Manifest keys article contains the complete list of default and optional keys. The files assigned as the extension service worker, the popup HTML file, the options page, the content scripts, etc.The Chrome API keys and permissions that the extension needs.


If you are not familiar with Chrome extension development, we recommend first reading Extensions 101 and Development Basics.
#CHROME EXTENSION MOUSELESS 2018 HOW TO#
It does not describe the code-level details of how to write an extension. This page describes the structure of an extension, the role each part plays, and how they work together. A Chrome extension is composed of different parts.
