0

I'm writing a lightweight replacement for new tab with a little bit of css and scripts. When I profile the performance of the new tab, index.html takes 10-15ms to start loading and it takes 50-150ms to load, despite that the file itself is 270 bytes only. It causes noticeable lag before the page is displayed.

How can I preload index.html with all the styles/fonts and keep in the memory? I assume I open new tab quite often, so minimizing any kind of delay is highly desirable.

Also, I programmatically apply dark mode with script.js logic and sometimes I see white flash before the dark mode gets applied. Which strategies can I use to avoid this problem?

Edit: I noticed that is when at least one instance of my new tab is opened, all subsequent new tabs are loaded much faster. I tried to turn off my extension, turns out default Google Chrome new tab behavior is exactly the same. So if you want your new tabs to load fast, keep at least one new tab opened... Still, I hope that this problem is solvable.

Vlad Volkov
  • 183
  • 3
  • 5
  • 1
    The only method is to declare a persistent background script, even an empty one. – wOxxOm Aug 13 '21 at 20:47
  • 1
    See also how to make this behavior customizable by the user: [for MV2](/a/58577052) and [for MV3](/a/66618269). – wOxxOm Aug 14 '21 at 05:27

0 Answers0