addInlineJs only works once


#1

I have a very strange problem.

Javascript code should be inserted inside the page. So i do:

{% set script %}
  ... some JS Code...
{% endset %}
{% do assets.addInlineJs(script,{ 'group':'bottom','priority':100 }) %}

and
{{ assets.js('bottom') }}

The first time I load the page everything works perfectly. But, if I click on F5 to reload the page, the JS code is no longer available.

But why???

Thank you very much!


#2

Okay, I found out it’s related with the caching. If I turn off caching, it works.
But that can’t be the solution. :wink: