Hello,
I've developped several plugins for wordpress that require JQuery.
As I have packaged and distributed these plugins separately, they come
all with one version of JQuery.
The problem is that if someone uses two of these plugins, the HTML
header will look like :
script type=text/javascript src=http://mysite/plugin1/jquery.js;
/script
script type=text/javascript src=http://mysite/plugin1/
jquery.plugin1.js /script
script type=text/javascript src=http://mysite/plugin2/jquery.js;
/script
script type=text/javascript src=http://mysite/plugin2/
jquery.plugin2.js /script
There are two issues here :
* JQuery is loaded twice
* The plugin declared by plugin1 will be erased by the second load of
Jquery.js.
Can I load Jquery dynamically by testing it is not already loaded ?
I'm searching for a way to replace :
script type=text/javascript src=http/mysite/plugin1/jquery.js /
script
by
script type=text/javascript
if (!jquery_loaded) {
dynamic_load(http://mysite/plugin1/jquery.js;);
}
/script
Thanks in advance for your help.
Raphael