Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#33210 closed enhancement (wontfix)

Add a preconnect header along with emoji settings JS

Reported by: pento Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Emoji Keywords:
Focuses: performance Cc:


Adding this to the header along with the _wpemojiSettings script would tell browsers that support it (currently Chromium trunk and Firefox) to pre-connect to the CDN, getting DNS lookup and SSL negotiation out of the before it's actually needed.

On my connection, this was ~90ms, which would be saved on the time from DOMContentLoaded to the first emoji render.

<link rel="preconnect" href="https://s.w.org">


Change History (7)

#1 @johnbillion
6 years ago

  • Keywords needs-patch added

We could add generic support for every distinct host that gets enqueued with wp_enqueue_*().

#2 @johnbillion
6 years ago

Actually, that doesn't make much sense. I'm guessing preconnect is intended for hosts of assets that aren't directly referenced in the <head> already.

#3 in reply to: ↑ description @peterwilsoncc
6 years ago

Replying to pento:
Was the ~90ms saved hard coding in HTML or adding via JavaScript once the result of ( ! settings.supports.simple || ! settings.supports.flag ) is known?

If it's added, adding it via JS while twemoji is running would avoid any ill-effects in browsers supporting emoji.

#4 @pento
6 years ago

I don't even know how browsers will handle it being inserted via JS. :)

That was with hardcoding in the header - an entirely unscientific method, but gives us a rough idea of saving.

#5 @swissspidy
6 years ago

See also #34292 for a general solution for resource hints.

#6 @pento
6 years ago

  • Component changed from General to Emoji

#7 @pento
5 years ago

  • Keywords emoji needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing in favour of #34292.

Note: See TracTickets for help on using tickets.