4

A browserAction in my Chrome extension takes about 250ms to display its popup, popup.html. However, when popup.html is already open in a tab in the browser, then the browserAction popup displays almost instantly.

manifest.json:

{
  "manifest_version": 2,
  "version": "1.0.0",
  "name": "MyExtension",

  "browser_action": {
    "default_icon": "icon-38x38.png",
    "default_popup": "popup.html"
  }
}

popup.html:

<!doctype html>
<html>
 <body>
  <div>hello<div>
 </body>
</html>

Chrome DevTools shows the tab fully loaded in 2ms.

How do I make it fast? Can I keep popup.html always loaded in the background?

pjvandehaar
  • 1,070
  • 1
  • 10
  • 24

1 Answers1

10

Modify manifest.json to include

"background": {
    "page": "popup.html"
},
pjvandehaar
  • 1,070
  • 1
  • 10
  • 24
  • Do you have any additional information about why or how this improves performance? Thanks. – John Apr 01 '15 at 04:48
  • Just a guess: When `popup.html` is open in a browser tab or the extension's background page, then it's already in RAM. Avoiding a disk access should save a lot of time. But a disk access shouldn't be taking 248ms. Maybe Chrome can re-use the compiled javascript/css/html? – pjvandehaar Apr 02 '15 at 06:57