Don't attempt to append to doc.head. Fixes #3287

Attempting to append the dynamically-created script tag to document.head
    doesn't always work. In our case, it isn't working in IE8. Instead, we
    use an entry point that's guaranteed to exist, by finding the 0th script
    tag on the page. There must be at least one script tag, since the script
    itself is somehow running :-)