9951 explained code solutions for 126 technologies


chrome-extensionLoad persistent background script


{
  "name": "My",
  "manifest_version": 3,
  // ...
  "background": {
    "service_worker": "bg.js"
  },,
  // ...
}ctrl + c
"background"

specify scripts to load in background

"bg.js"

name of the background script to load (should be placed in the same folder as manifest.json)