Question:

Javascript running twice when not logged in

Layla: 20 May 2022

I have this issue that any custom js (added into theme.info file) script file is runned twice. However, I noticed that it will be runned only once if I am logged in. This happens in Drupal 7.

What is the cause?

The js script is a clear only having alert("Entered js file");

Also it is not added twice in the info and also looking into source code not there twice either.

The function is triggered while nothing rendered on page and second time when all DOM elements are loaded.

Answer:
Emilia: 20 May 2022

I finally found out what was causing this issue. It was a module named Drupal for Firebug. So, if anyone finds this, disable this module and you will be fine.