The Science of the waterproof handkerchief
There are no special tricks here - just a normal handkerchief and a simple glass of water.
The trick works because the handkercief gets wet before the glass is turned upside down. That means that all the little gaps between the threads in the handkerchief are full of water and the surface tension of the water in these tiny holes is enough to hold the water back.
This only works when the pressure on the holes is nearly straight down, though, which is why you need to use the ashtray to stop the water getting out while you turn the glass over.
You can see another example of a small hole holding liquid into a container with the non-drip can.
Of course, this does not actually filter the water at all!