JS Object in header Script tag is reloaded on every page, logs error | XM Community
Skip to main content
Question

JS Object in header Script tag is reloaded on every page, logs error

  • July 5, 2024
  • 1 reply
  • 38 views

Forum|alt.badge.img+5

I have loaded in a large javascript object from a script tag in my survey header. However, my console displays ‘Uncaught SyntaxError: Identifier 'abc' has already been declared (at abc.js:1:1)’ 

 

I thought that the JFE would only load this header once, but it seems to be reloading it on every page transition - how do I fix this?

1 reply

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • July 5, 2024

The header will load on every page, there’s no fix for it.

If you want the script only on one page, you could load it using javascript:

Qualtrics.SurveyEngine.addOnload(function () {
    jQuery.getScript("SCRIPT URL")
});

 


Leave a Reply