I am working on a Javascript library that is currently used by our sites (> 8000). Web sites call the js loader, which on it will link to other library scripts.
Since our JavaScript library uses jQuery heavily, it is currently included in bootstrapper as well.
This is done using document.writeln:
document.writeln("<script src=\"js\/jquery-1.4.4.min.js\" type=\"text\/javascript\"><\/script>");
I know that document.writeln is not xHtml compatible and there are much better solutions, but this is exactly how it currently works great for all of our websites and getting rid of document.writeln is not an option.
Now the problem is that we get conflicts when the site already defines a lower version of jQuery. So, we decided to redefine jQuery in our library:
document.writeln("<script src=\"js\/jquery-1.4.4.min.js\" type=\"text\/javascript\"><\/script>");
document.writeln("<script type=\"text\/javascript\">");
document.writeln(" var $myJQuery = jQuery.noConflict();");
document.writeln("</script>");
, .
- ?