Chrome extension: Execute background page only once when chrome starts

前端 未结 3 2007
旧巷少年郎
旧巷少年郎 2021-02-03 14:12

I am playing with chrome extensions, my manifest loads a background page with:

...
"background": { "scripts": ["background_page.js"]         


        
3条回答
  •  春和景丽
    2021-02-03 14:55

    UPDATE: According to current documentation you simply have to delete the persistent key (no need to change it to "persistent": true).

    This is an event page:

    {
      "name": "My extension",
      ...
      "background": {
        "scripts": ["eventPage.js"],
        "persistent": false
      },
      ...
    }
    

    This is a background page:

    {
      "name": "My extension",
      ...
      "background": {
        "scripts": ["background.js"]
      },
      ...
    }
    

提交回复
热议问题