code: public static boolean isInHeader(final String scriptname) {
      final NodeList linkList =
          Browser.getDocument().getHead().getElementsByTagName(CssResources.TAG_TYPE);
      for (int i = 0; i < linkList.getLength(); i++) {
        final LinkElement linkTag = (LinkElement) linkList.item(i);
        if (StringUtils.equals(linkTag.getType(), CssResources.SCRIPT_TYPE)
            && StringUtils.equals(linkTag.getRel(), CssResources.REL_TYPE)
            && StringUtils.contains(linkTag.getHref(), scriptname)) {
          return true;
        }
      }
      return false;
    }
docs: check if script is already in the header.
  
  @return true if it exists