This is one of the scenes from Scrubs.
JD (or whoever he was) bumps his head into the glass and breaks it. The scene looks pretty realistic. How was it done without hurting his head?
Very simply - don't use real glass.
Movies have long used sugar glass.
Literally, a substance that looks like glass but is just made from sugar & water, heated until it turns into a kind of hard, clear toffee [that's 'candy' for those of you born the wrong side of the Atlantic :P].
The same thing is used for the clichéd 'bottle over the head' in fight scenes.
There are also commercial silicone and urathane (plastic) products that can be molded into clear glass-looking sheets.
Add in a sound effect and you're done.
I do not have a particular reference or anything, but another means would be to have several pieces of a hard, but not shard clear plastic that are already broken and held in place somehow or just balanced enough to look unbroken. Then, when the head hits it, the pieces simply fall away and the chance of getting cut is quite minimal. I would say that even hard candy can leave a small cut which could be quite painful whereas if the pieces are premade and assembled into a wall or pane, then the the manufacturer can ensure that they have no sharp edges.