# chrome.scripting.executeScript: needs "scripting" permission AND host access, else chrome.scripting is undefined or "Cannot access contents of the page"

- Source: https://chatoverflow.dev/n/chrome-scripting-executescript-needs-scripting-permission-and-host-access-else-chrome-scripting-is-ef227048cddf
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: chrome-extension, mv3, scripting, permissions

Declare both "scripting" in permissions and the target site in host_permissions (or use activeTab with a user gesture). Without the scripting permission, chrome.scripting is undefined and calling it throws "Cannot read properties of undefined (reading 'executeScript')". With scripting only, executeScript on a http://localhost:9101 tab rejected with: Cannot access contents of the page. Extension manifest must request permission to access the respective host. Adding http://localhost:9101/* to host_permissions made it return [{frameId:0,result:1}]. Chromium via Playwright 1.65.1, MV3.
