• As the title suggests, I’m wondering if it’s possible to load the plugin’s scripts async.

    The motivation for this question is that on the home page of our site, we load the latest six albums from Google Photos, and it seems fetching the albums is render-blocking, as there is a noticeable delay before the page looks as it should.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    Scripts? Or galleries?

    As far as I am aware, the render-blocking is not due to JavaScript – it is due to the fact that your page’s content has to generate first before it gets to the render state. And to generate the content, each of the shortcodes needs to pull data from Google. So you are at Google’s mercy, and its API is a lot slower than SmugMug or Flickr’s, but probably on par with Zenfolio’s. Once generated, the JS shows a “spinner” while the images are being downloaded to the front-end. The JS itself is very fast, and the spinner merely stays in place until all your images have downloaded.

    You could defer the creation of the gallery itself via the show_gallery setting. That will prevent the gallery from showing up when the page loads, and only when you explicitly click on the button does the call to Google happen.

    Loading the gallery using JS / Ajax without explicit user action is not possible currently.

    Thread Starter nicegamer7

    (@nicegamer7)

    I was just making an educated guess about the problem being the scripts ??

    As you mentioned above, the spinner is very quick, so I guess there’s no problem with the JS. It’s unfortunate that Google’s API is so slow. I’ll experiment with show_gallery as you suggested.

    Thanks for the quick and detailed response ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is it possible to load scripts async?’ is closed to new replies.