Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

addInlineJs only works once

Started by finrik 9 years ago · 1 replies · 834 views
9 years ago

I have a very strange problem.

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

TWIG
{% 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!

9 years ago

Okay, I found out it's related with the caching. If I turn off caching, it works.
But that can't be the solution. ;)

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by FrViPofm, 4 weeks ago
4 469 2 weeks ago
Themes & Styling · by johan thomas, 5 years ago
1 799 3 weeks ago
Themes & Styling · by stuart young, 2 months ago
3 656 2 months ago
Themes & Styling · by Sebadamus, 3 months ago
5 677 2 months ago
Themes & Styling · by martynfoster735, 3 months ago
1 640 3 months ago