Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Load custom javascripts to bottom of body tag from config.xml?

  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago #210343 by jackrabbithanna
I'm wanting to add some additional javascript to the bottom of the body tag instead of the head.

Is there a standard way to do this from the config.xml with <add> tags .. ?

Maybe a "best" way to do this?

Thanks in advanced!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210345 by Joffm
At the end of the "layout_global.twig" before </body>?

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago #210347 by jackrabbithanna
correct .. I know I could hardcode something, just wondering if there's a way to specify from config.xml of theme or if there are existing best practices.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210356 by holch
What is the difference between writing it into the twig file or into the config file of a theme? Both is "hard coded" in a way, isn't it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210357 by tpartner
As far as I know, it cannot be done via config.xml.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago #210362 by jackrabbithanna
IDK what all differences may be, that's why I ask. When I develop something, I aim for "best practices", and understanding the infrastructure best I can.

I know in 3.x we can add js via config.xml and not having to put in head manually .. Another difference maybe inheritance with the <replace> tag.
It is becoming more standard to load JS in bottom of body tag for quicker first paint times.

No big deal I'll pop it in there manually.

Thanks everybody!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210377 by DenisChenu

jackrabbithanna wrote: I know in 3.x we can add js via config.xml and not having to put in head manually .. 

js file, not javascript, no ?

Else : can be a great feature to allow $position in XML attaribute, default to POS_HEAD
Need a feature request

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210407 by holch

It is becoming more standard to load JS in bottom of body tag for quicker first paint times.


Definitely a good idea to load JS in bottom of the page, if possible (especially when from an external source).

Many years ago we "stopped" the website of a maior car brand once because our server where the javascript was hosted went down. Unfortunately they had implemented our script in the header and not like we recommended at the end of the html code.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago #210415 by jackrabbithanna
@DenisChenu

Right, I'm talking about a javascript file.

What is your preferred way to receive feature requests? Github repo issue?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210418 by DenisChenu

 What is your preferred way to receive feature requests? Github repo issue?

Remind : i'm not from LimeSurvey GMBH team … only an external dev like you :)

But:
  1. read github.com/LimeSurvey/LimeSurvey/blob/ma...G.md#getting-started
  2. read community.limesurvey.org/feature-request/
  3. read manual.limesurvey.org/Standard_for_Git_commit_messages

Start by a mantis issue :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose