function extractDomain(url) { var domain; //find & remove protocol (http, ftp, etc.) and get domain if (url.indexOf("://") > -1) { domain = url.split('/')[2]; } else { domain = url.split('/')[0]; } //find & remove port number domain = domain.split(':')[0]; return domain; } // use minified version in prod to stifle console logging if(extractDomain(window.location.href).indexOf("www") > -1) { jmFileName = "jquery-migrate-1.4.1.min.js"; } else { jmFileName = "jquery-migrate-1.4.1.js"; } $.getScript('/onecpd/jquery/' + jmFileName);