Macro javascript loading twice on mobile browser

We have noticed that javascript is loading as expected on a desktop browser but on mobile, it is getting executed twice. After investigation, we have found that two different versions of the files get loaded as per the below image. Is there any configuration changes needed to load file only once or is this confluence bug?

Can you please share with me here how do you load a simple javascript to the page? I cannot get it working and seems atlassian stuff does has no clue. Thank you!