Experimenting with preload/preconnect - is it possible?

Hi Tim!

I watched your video on experimenting with service workers and WebPageTest. Wonderful stuff!

It made me wonder if is it possible to experiment with preload/preconnect using Inject Script. Is it?

I found these two amazing snippets, but they didn’t seem to work for me:

Do you know of a resource that can help?

Thanks!

Do you have a test result URL with a preconnect or preload that isn’t working that you could share? If it is for a font, make sure you are using “crossorigin” but depending on the resource type, if it is already in the HTML and parseable, the browser may already be discovering it as fast as possible.

Hi Patrick,

Thanks so much for chipping in.

Here is the original test: WebPageTest Test Result - Virginia USA - E...ights-to-dubai-dxb - 09/23/21 22:11:51

Here is the test with preconnect (script from Andie Davis’ article): WebPageTest Test Result - Virginia USA - E...ights-to-dubai-dxb - 09/26/21 15:27:19

And here is the script with preload (script from Hariom Balhara’s article): WebPageTest Test Result - Virginia USA - E...ights-to-dubai-dxb - 09/26/21 15:29:03

It’s for an image in this case. Maybe I’m doing something wrong, obviously.

Greatly appreciate your input.

Thank you!