Tapping repeatedly on the top of a canned carbonated beverage prevents the soda from exploding in your face, or all over your clothes.
It's not just a myth: Tapping the top of the can repeatedly does help by pushing troublesome gas bubbles to the top, where they are less likely to force liquid out when opened.
Generally, tapping for 10 to 15 seconds should do the trick, but the science behind this method is debated.
There are variables, like different carbonation levels in various soda brands. Additionally, factors such as time and temperature need to be taken into account.