Astronomers did not know what these objects were until the first spectroscopic experiments were done in the 1800's. William Huggins used a prism to look at galaxies. He noticed that they looked a lot like stars.