Then don't take the cap off once the car is warm. Having the pressure raises the boiling point of the water, taking the cap of causes it to boil instantly, which is why your radiator cap says 'Ne pas ouvrir a chaud' (aka really badly translated french for 'Never open while hot')
In order to check the headgasket that way you must start the car from cold and allow it to warm up to temp with the radiator cap off, you should get the odd bubble as it warms up, and yes the water will overflow a bit (water expands as it heats up). What you are looking for is frothing, you'll have a little bit if you insist on revving it (don't) but a blown headgasket will cause constant frothing.
Once the fans come on, you're done. If it hasn't started frothing and foaming by then there is absolutely nothing wrong with your headgasket.