I created a wordpress plugin (say P1 ) in which I used fancybox (a jquery plugin). I included its js using wordpress’s wp_enqueue_script() function.
But, on my client wordpress blog, he is using some other wordpress plugin, one of them (say P2) also use fancybox.
When both these P1 and P2 are active, fancybox js loads 2 time one from P1 and another from P2. And due to this it gives error
loading is undefined (on line 36)
can I
- prevent fancybox to load 2 or more times from my wordpress plugin
- or handle this js error
prevent
you can prevent loading your script twice from your side (wordpress side) if you have control over it.
You can probably use the typeOf operator to see if a particular fancybox has already loaded and if yes you do not include it twice.