An unexploded bomb which is thought to be from the Second World War was detonated by the Royal Navy in a Yorkshire river.