Browser extension developers often find the need to execute JavaScript in the background of a browser. Background scripts, as their name suggests, are the answer to this problem: they are a separate JavaScript runtime that can communicate with all the different pieces of the extension, add handlers for many different browser events, and operate without dependence on any web page or extension user interface.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Background Scripts

  • Matt Frisbie

摘要

Browser extension developers often find the need to execute JavaScript in the background of a browser. Background scripts, as their name suggests, are the answer to this problem: they are a separate JavaScript runtime that can communicate with all the different pieces of the extension, add handlers for many different browser events, and operate without dependence on any web page or extension user interface.