William Shakespeare is credited with the origin of the knock-knock joke. The earliest written example appears in his play Macbeth.