Download Algolia search asynchronous

I am currently using Algolia Instant Search

It works well, but it requires external javascript-librairies. One is Hoogan.JS and the other is Algolia Search JS file.

My site relies heavily on SEO and I keep track of the Google PageSpeed ​​tool all the time.

It is important for me to keep up to 85 and for that I need to load my JS files asynchronously.

The problem is when I do this I get undefined AlgoliaSearch or Hoogan because my code is always loaded before one of these files.

I don't know how to load them ASYNC, but specify the order. From what I understand, this is really not possible.

+3


source to share


1 answer


Unfortunately, it looks like you have no control over the ordering async JS files it will execute.

Solution 1 The
best solution I would like to offer you is to concatenate the JS files in the correct order and only load one asynchronously.



Solution 2
See Head.js . However, this appears to have been discontinued as the last commit dates back to 2013.

+2


source







All Articles