Preload chrome extension to reduce extension load time

Viewed 903

I have a chrome extension that loads WEBGL assets in certain cases. The main html dashboard that opens on extension click is here:

<!DOCTYPE html>
<html style="width:640px;height:320px;">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Mindpass</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen">
</head>

<html>

<head>    
<body>    
<script src="start.js"></script>
<div id="gameContainer" style="width: 100%; height: 100%; margin: auto; z-index:1; overflow: visible"></div>
<script src="UnityLoader.js"></script>
<script src="gameInstance.js"></script>
</body>
</html>

The WEBGL build (loaded by the three calls after start.js is called) takes too long to load. How can I get those assets preloaded so that they show up when the extension is opened, rather than having to wait for the full load time when the extension is opened?

Note: Current permissions and background scripts are as follows:

  "permissions": ["tabs", "activeTab", "storage", "<all_urls>", "cookies"],

  "background": {
  "scripts": [
     "background.js"
   ],
   "persistent": false
  }
0 Answers
Related