The first handheld guns were essentially miniature cannons; you loaded some gunpowder and a steel ball, then lit a fuse. Eventually, this technology gave way to trigger-activated weapons, such as the flintlock and percussion cap guns.
Flintlock guns ignited gunpowder by producing a tiny spark, while percussion caps used mercuric fulminate, an explosive compound you could ignite with a sharp blow. To load a percussion cap gun, you pour gunpowder into the breech, stuff the projectile in on top of it, and place a mercuric fulminate cap on top of a small nipple. To fire the gun, you cock the hammer all the way back and pull the gun's trigger. The trigger releases the hammer, which swings forward onto the explosive cap. The cap ignites, shooting a small flame down a tube to the gunpowder. The gunpowder then explodes, launching the projectile out of the barrel. (Take a look at How Flintlock Guns Work for more information on these weapons.)
The next major innovation in the history of firearms was the bullet cartridge. Simply put, cartridges are a combination of a projectile (the bullet), a propellant (gunpowder, for example) and a primer (the explosive cap), all contained in one metal package. Cartridges form the basis for most modern firearms. The backward motion of the gun's bolt also activates its ejection system, which removes the spent shell from the extractor and drives it out of an ejection port. We'll discuss this in more detail later. But first, let's take a look at how all of this works -- in a revolver.