Use refresh instead of document.write()

This fixes all the encoding issues, but it has a slightly different feel because the browser does a obvious page refresh (the favicon momentarily switches to a progress indicator, etc).