If you have to nail a piece of molding, in a wood frame, against a piece of glass, as shown in Figure 1, such as a French door (Figure 1), there is always the concern that the hammer will slip off the nail head and break the glass.
Figure 1 - Double French Doors
This situation may occur if it becomes necessary to replace a broken or cracked glass windowpane. There is an easy solution to the problem and that is to run the hammerhead against the glass, parallel to the glass, as shown in Figure 2.
Figure 2 - Correct method for hammering a nail or brad next to a pane of glass
As the hammerhead uses the glass as a guiderail it is not possible for the hammerhead to hit the glass on an angle and thus crack the glass.
Do not use a claw hammer as the claws protrude beyond the side of the hammer head. Use a ball pein hammer, (also spelt ball peen) as shown in Figure 3, as the ball-pene hammer does not have anything that protrudes past the edges of the hammer head.
Figure 3 - Ball pein hammer
Although this method should not scratch the glass, if you are concerned about potential scratching you can apply some masking tape to the surface of the glass and then remove it when you have completed the nailing of the molding to the doorframe.
If the door is a hardwood such as oak, drill a pilot hole for the nail. The diameter of the pilot hole should be slightly smaller than the diameter of the nail.
To use a countersink on the nail, hold the countersink perpendicular to the glass and slide the hammer along the glass in the same manner that was used for the nail itself.