Kiser and colleagues have been working to develop a "molecular condom" for some years. In 2006 they published a paper on an earlier type of gel that was applied to the vagina as a liquid that became a gel at body temperature, and then became liquid again in the presence of semen, whereupon it released an anti-HIV drug.
But the problem with this earlier attempt was that in Africa, the high ambient temperatures stopped the gel from becoming liquid again, which stopped it coating the vaginal lining evenly. Also, there aren't many antivirals that bind and attack HIV in the presence of semen.
So Kiser and colleagues went back to the drawing board. This time they came up with a new gel that works in the opposite way to the old one. The new gel responds to changes in pH (acidity or alkalinity) so that when it comes into contact with the less acidic semen it becomes a semi-solid instead of more liquid, and also forms a network of interlinked molecules like a mesh.
The gel is made of two polymers, PBA (phenylboronic acid) and SHA (salicylhydroxamic acid). Polymers are repeating patterns of long chain-like molecules, like a chemical "spaghetti". In this case, imagine one type of spaghetti is made of PBA and the other is made of SHA, that under the normal acidity inside the vagina, where pH is around 4.8, the bonds between them are weak so the strands of spaghetti slip and slide around each other easily: and the gel remains a gel.
But when the environment becomes less acidic, and becomes increasingly alkaline, at around pH of 7.6, which is what the vaginal environment becomes in the presence of semen, the spaghetti strands of PBA and SHA stick together much more strongly, and the gel becomes semi-solid.