instantpage / instant.page

Make your site’s pages instant in 1 minute and improve your conversion rate by 1%
https://instant.page
MIT License
6.04k stars 205 forks source link

Add defer attribute to default snippet so it loads last #42

Closed coliff closed 4 years ago

coliff commented 5 years ago

I noticed that 'instant.page' was loading on https://instant.page/ with High Priority, which meant that it was loading before other scripts on the page. I added instant.page to my own site and saw it was loading with 'Medium Priority' (even though it was at the very bottom of the page) which meant that it was loading before some images on the page. I think it'd be good if instant.page always loaded last.

I added 'defer' attribute to the snippet on my site so it always loads last and was thinking you could recommend the same?

dieulot commented 4 years ago

It’s done, thanks for the suggestion.

coliff commented 4 years ago

cool :-) can you please add defer to the WordPress plugin too?

Right now it is: <script type="module" src="/wp-content/plugins/instant-page/instantpage.js"></script> but I'd prefer: <script type="module" src="/wp-content/plugins/instant-page/instantpage.js" defer></script> especially since that script is in the head rather than at the bottom of the body.

dieulot commented 4 years ago

I’ll do it when instant.page has a new version!