I have two scripts that load in my head area which are:
<script type="text/javascript">
var myDate = new Date();
var myStamp = ""+myDate.getDate()+myDate.getMonth()+myDate.getFullYear()+myDate.getHours()+myDate.getMinutes();
document.write('<script type="text/javascript" src="https://scriptlocation.com/js/script.js?' + myStamp + '"><\/script>');
</script>
<script type="text/javascript">
document.write('<script type="text/javascript" src=""https://scriptlocation.com/js/script2.js?'+SVNInfo.revision+'"><\/script>');
</script>
My ideal scenario would be to merge these two into 1 javascript file, so I’ve tried to create a new file which contains the following:
var myDate = new Date();
var myStamp = ""+myDate.getDate()+myDate.getMonth()+myDate.getFullYear()+myDate.getHours()+myDate.getMinutes();
document.write('<script type="text/javascript" src="https://scriptlocation.com/js/script.js?' + myStamp + '"><\/script>');
document.write('<script type="text/javascript" src=""https://scriptlocation.com/js/script2.js?'+SVNInfo.revision+'"><\/script>');
however that does not seem to work as the script is not being loaded properly. Do I need to rewrite / change something to have this working correctly?
Some advice would be greatly appreciated.
This should do the trick.
For the record,
document.writeis an extremely primitive (and not a friendly way) of adding scripts to the page. Just create them as elements and then add them to the DOM.