(CNN) A 4-year-old Chinese boy has been rescued after getting his head stuck in security bars, leaving him dangling from a fourth-story window.

Dramatic footage of the incident shows the boy hanging high above the ground in a residence in Linyi City, in eastern China's Shandong province.

According to Chinese state media CCTV, the boy climbed out of the window on Monday afternoon and fell, leaving his head stuck between the bars around the window frame.

The boy's grandfather was taking a nap at the time, but was woken by the boy's cries. He called firefighters for help, and they rushed to the scene. The boy's parents were not home at the time.

Rescuers fastened a rope to the boy's chest and grasped his clothes. Outside, residents held a quilt for the boy to soften his fall if he slipped.

Read More