Hi i am trying to create a plugin for my client, i will just add the following code in their html.
<html>
<head>
</head>
<body>
<script type="text/javascript">
var clientID = "123";
(function() {
var test = document.createElement('script'); test.type = 'text/javascript'; test.async = true;
test.src = 'myjavascript.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(test, s);
})();
</script>
<div id="addimage"></div>
</body>
</html>
And in myjavascript.js file i will call the jquery library.
if (typeof jQuery === "undefined") {
var script = document.createElement('script');
script.src = 'http://mysite.com/js/jquery-1.7.1.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
if (typeof jQuery === "undefined") {
var script = document.createElement('script');
script.src = 'http://mysite.com/js/fancybox.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
// my rest code goes here
So i would like to check whether the client html already has to call for jquery-1.7.1.min.js if not, then only include the 1.7.1.min.js file in myquery.js
How to check whether its already included or not. Please help!