Tannic acid-modified AgNPs showed good antiviral effects on HSV-2 infection in vitro and in vivo.