code: public static boolean isInHeader(final String scriptname) {
      final NodeList scriptList =
          Browser.getDocument().getHead().getElementsByTagName(JsResources.TAG_TYPE);
      for (int i = 0; i < scriptList.getLength(); i++) {
        final ScriptElement scriptTag = (ScriptElement) scriptList.item(i);
        if (StringUtils.contains(scriptTag.getSrc(), scriptname)) {
          return true;
        }
      }
      return false;
    }
docs: check if script is already in the header.
  
  @return true if it exists