code: function injectScriptTag(script) {
    // Get some kind of target to put the script in.
    // Only valid documents get body/head, so this is a nice way to ignore bad
    // ones. Try to insert as early as possible.
    var targetElement =
        document.documentElement || document.head || document.body;
    if (targetElement) {
      if (targetElement.firstElementChild) {
        targetElement.insertBefore(script, targetElement.firstElementChild);
      } else {
        targetElement.appendChild(script);
      }
      script.parentNode.removeChild(script);
    }
  }
docs: Injects a <script> tag into the document as early as possible.
  The hope is that the injected contents run before any of the user code.
  @param {!Element} script <script> element.