From http://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download