I am looking to develop a javascript web service that a website can include in a single line of code, similar to how Google Analytics is used. I would like to use jQuery in my javascript code, but I do not want it to contradict any js libraries that may already be present on the hosting web page.
Basically, inside my main javascript file that the end user will include in his webpage, I would like to do something like:
document.write('<script type="text/javascript" ' + 'src="http://mydomain.com/js/jquery-1.4.2.min.js"></script>');
... make jquery available in my code library. I am wondering if this is the right way to use jquery in an api java script, or if there are more considerations to be made. I would appreciate any examples or articles anyone can offer.
source share