Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

addInlineJs only works once

Started by finrik 8 years ago · 1 replies · 628 views
8 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!

8 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 Pedro M, 2 months ago
4 197 2 months ago
Themes & Styling · by Ian, 2 months ago
3 92 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 454 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 47 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 127 3 months ago