Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

browserAction opens slowly unless already open in a tab

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?

like image 805
pjvandehaar Avatar asked Dec 26 '22 17:12

pjvandehaar


1 Answers

Modify manifest.json to include

"background": {
    "page": "popup.html"
},
like image 156
pjvandehaar Avatar answered Dec 28 '22 05:12

pjvandehaar