Incidentally, this method cured me of arachnophobia. Having it trapped inside the glass, yet in my hand and up close to take a closer look, allowed me to gradually see them as not all that scary. It's like that therapy where you gradually get closer to the thing you're afraid of (desensitization?).
I deal with trespassing flies this way. They spend some time in fly jail (butterfly net, twisted closed and propped against the door frame through which they entered) pour encourager les autres, then they go free outside at dusk.
Pheromones, interpretive dance, telepathy,—I don’t know exactly how the others get the message but I know that they do, and they stay on the correct side of the doorway.