Hello,
I have an app that uses a ScriptTag.
Sometimes, merchants contact me saying that my app is not working, and when I investigate I notice that the script tags are not loaded (not just my script tag, any script tag that is installed on the store).
Lately, I noticed 2 apps messing with the original loading script and breaking it (not sure if it becomes broken when the app is active or when it’s deactivated … perhaps it worked at some point).
This app seems to turn the original type=”text/javascript” into type=”text/flspdscript” (FLSPD standing for “flash speed” I guess), which make some navigators ignore the script content.
2. Another unknown app (I couldn’t identify it yet, sorry, perhaps it’s even a theme template?) seems to add a “MutationObserver” like the one below that modifies the original ScriptTag loading script.
<script type="text/javascript"> const observer = new MutationObserver(e => { e.forEach(({ addedNodes: e }) => { e.forEach(e => { 1 === e.nodeType && "SCRIPT" === e.tagName && (e.innerHTML.includes("asyncLoad") && (e.innerHTML = e.innerHTML.replace("if(window.attachEvent)", "document.addEventListener('asyncLazyLoad',function(event){asyncLoad();});if(window.attachEvent)").replaceAll(", asyncLoad", ", function(){}")), e.innerHTML.includes("PreviewBarInjector") && (e.innerHTML = e.innerHTML.replace("DOMContentLoaded", "asyncLazyLoad")),(e.src.includes("assets/storefront/features")||e.src.includes("assets/shopify_pay")||e.src.includes("connect.facebook.net"))&&(e.setAttribute("data-src", e.src), e.removeAttribute("src")))})})});observer.observe(document.documentElement,{childList:!0,subtree:!0})</script>
As you can see on the screenshot below, it “noops” the original “onload” listeners and ties everything to an “asyncLazyLoad” event that seems to be never fired (on some websites).
Here is a website where it’s broken :
Here is a website where it seems to be working :
A quick search on publicwww for the “MutationObserver” snippet seems to give more than 5k results so I’d assume that it’s a widespread app (but I could be wrong).
Anyway, this is a bit disturbing for app developers who still use ScriptTags.
Is there something we can do as another app developer in this case? Is there anything in the app review process to prevent this from happening perhaps?
Thank you for your help!
Sorry if the topic category is not right.

