Copy/pasted error handling code for IE/Safari from the website I found
because it was very easy.