Our application loads jQuery 1.10.2 and then loads https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js
from Intuit. The anywhere script is adding <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
to the head and reloading jQuery.
This is wiping the namespace and wrecking much of our code. Shouldn't the script see that jQuery is already loaded? How do we prevent jquery from being reloaded?
Thanks, Forrest
The problem seems to be that window.jQuery.fn.jquery < "1.4.2"
returns false as '1.10.2' < '1.4.2'
will also return false. It is because javascript will see it as 1.1.2 < 1.4.2
. Another option is to remove the || window.jQuery.fn.jquery < "1.4.2"
If you are sure that you are including jQuery just change the part of the code where it appends the script tag.
At the bottom of the script. Change
// function that starts it all. timeout is 0
(function() {
// these are the domains whose js files we're going to look at
// intuit.ipp.ourDomain = /(.intuit.com).*?#(.*)/;
intuit.ipp.ourDomain = /intuit.com$/;
if(window.jQuery === undefined || window.jQuery.fn.jquery < "1.4.2") {
// minimum version 1.4.2
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js");
script_tag.onload = function () {
if(window.jQuery) {
intuit.ipp.jQuery = window.jQuery.noConflict(true);
intuit.ipp.anywhere.windowLoad();
}
};
script_tag.onreadystatechange = function () { // Same thing but for IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
script_tag.onload();
}
};
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
} else {
// we do have jquery
intuit.ipp.jQuery = window.jQuery;
intuit.ipp.anywhere.windowLoad();
}
})();
To
// function that starts it all. timeout is 0
(function () {
// these are the domains whose js files we're going to look at
// intuit.ipp.ourDomain = /(.intuit.com).*?#(.*)/;
intuit.ipp.ourDomain = /intuit.com$/;
// we do have jquery
intuit.ipp.jQuery = window.jQuery;
intuit.ipp.anywhere.windowLoad();
})();