Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

scripting

Inserts JavaScript and CSS into websites. This API offers two approaches to inserting content:

Note:Chrome restricts this API to Manifest V3. Firefox and Safari support this API in Manifest V2 and V3.

This API requires the"scripting"permission andhost permission for the target in the tab into which JavaScript or CSS is injected.

Alternatively, you can get permission temporarily in the active tab and only in response to an explicit user action, by asking for the"activeTab" permission. However, the"scripting" permission is still required.

Types

scripting.ContentScriptFilter

Specifies the IDs of scripts to retrieve withscripting.getRegisteredContentScripts() or to unregister withscripting.unregisterContentScripts().

scripting.ExecutionWorld

Specifies the execution environment of a script injected withscripting.executeScript() or registered withscripting.registerContentScripts().

scripting.InjectionTarget

Details of an injection target.

scripting.RegisteredContentScript

Details of a content script to be registered or that is registered.

Functions

scripting.executeScript()

Injects JavaScript code into a page.

scripting.getRegisteredContentScripts()

Gets a list of registered content scripts.

scripting.insertCSS()

Injects CSS into a page.

scripting.registerContentScripts()

Registers a content script for future page loads.

scripting.removeCSS()

Removes CSS which was previously injected into a page by ascripting.insertCSS() call.

scripting.updateContentScripts()

Updates one or more content scripts already registered.

scripting.unregisterContentScripts()

Unregisters one or more content scripts.

Browser compatibility

Note:This API is based on Chromium'schrome.scripting API.

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp