Write out document with document.open/write/close to avoid origin
issues with srcdoc and the History API