This question already has an answer here:
- What happened to console.log in IE8? 17 answers
Sorry if I sound like a broken record, but I cannot find a relevant fix for this.
I am trying to run this script that changes the look and feel of a website based on the 'Season' (southern hemisphere), and I believe that the 'console' is undefined error that I am getting is killing this script. The images, colors, etc... do not show in IE8 (a necessary browser unfortunately) but in Chrome and >IE9 it works fine. So I am after an IE8-specific FIX
This is the code:
<script>
// JavaScript Document
function getSeason(d) {
d = d || new Date();
var mon = d.getMonth() + 1; // Adjust to be indexed from 1
var day = d.getDate();
var seasons = ['summer','autumn','winter','spring'];
// Do silly seasons here
if (mon == 12) {
if (day >= 13 && day <= 27) {
return 'xmas';
}
if (day >= 28 && day <= 31) {
return 'nye';
}
}
// If wasn't a silly season, do others
mon = Math.floor((mon % 12) / 3);
return seasons[mon];
}
console.log('Currently it is ' + getSeason()); // Currently it is summer
$(document).ready(function(){
document.body.className = getSeason();
});
</script>
I do have other code running in the page (such as Clocks and Slideouts and Copy to Clipboard) but for some reason... this one doesn't work.
Please, I hope someone can help me on this one. Again, I am sorry if I am asking questions that have been asked, but I cannot find an answer relevant. If you need more information, please ask.