JavaScript

How to ensure that duplicate JavaScript doesn’t run twice?

This often happens when your customers are using more than one plugin/addons both requiring the same JavaScript. You can avoid the execution of both of them by using the following trick. if(window.MyCustomNameSpace === true){ return false; } window.MyCustomNameSpace = true Why it works? The idea here is to set a namespace as soon as you […]

Scroll to top