Fixed IE8 throwing unknown runtime error

Replaced document.head (html5 only) with more compatible code: document.getElementsByTagName('head')[0]

Replace .innerHTML with .text - this makes the code work in IE8 instead of throwing and unknown runtime error