Gravatar for david.salcedo@bluegreenvacations.com

Question by dvsalcedo, Apr 11, 2019 3:33 PM

Issue with Relative Path

Good day,

I have a issue when my page is loading. The normal behaviour is that all javascripts files are loaded in the request url: http://example.com/Coveo/Hive/js/Searchbox.min.js .

But sometimes the javaxripot load in the request url: http://example.com/Searchbox.min.js , so here i have the issue because that resource in the path doesn´t exist.

I don´t find a solution, does anyone know about this?

thank you in advance.

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Apr 12, 2019 1:17 PM

I am copying the exact response as in your Sitecore StackExchange question. In the future, please avoid posting the same question on multiple sites.

----

This issue related to lazy loading, and the way the Coveo JavaScript Search Framework detects what is the path to use to lazy load its components.

This issue was fixed in `4.1.414` by adding `class="coveo-script"` directly on the script that loads the Coveo JavaScript Search Framework.

In the `Views/Coveo Hive/Resources/Coveo Search Resources.cshtml` file, the line

<script type="text/javascript" src='@(Html.Coveo().IsEditingInPageEditor() ? Model.Properties.CoveoSearchUiPath + "/js/CoveoJsSearch.Lazy.js" : Model.Properties.CoveoSearchUiPath + "/js/CoveoJsSearch.Lazy.min.js")'></script>

should now read:

<script class="coveo-script" type="text/javascript" src='@(Html.Coveo().IsEditingInPageEditor() ? Model.Properties.CoveoSearchUiPath + "/js/CoveoJsSearch.Lazy.js" : Model.Properties.CoveoSearchUiPath + "/js/CoveoJsSearch.Lazy.min.js")'></script>

Adding this tag will make it so the lazy loading path is properly detected, and will properly load the components.

I would recommend upgrading to at least 4.1.414 since it contains the fix that you need.

Ask a question