I have a page (contrived example below) with a Google doc and a download link. When the link is clicked the iframe goes grey and doesn’t come back at all. I’ve stripped the page right down so it is only these two elements and it still happens.
This definitely happens in Firefox, Chrome and Safari.
Iframes not containing Google docs do not seem to have this problem.
Any ideas?
<html>
<head></head>
<body>
<iframe src="http://docs.google.com/document/d/1mCYGLa8-Qsz_nYdk_f_8YefqWKMyulwVl223rebRMqM/preview" width="660" height="648"></iframe>
<a class="download_link" href="http://fastdl.mongodb.org/osx/mongodb-osx-i386-2.0.6.tgz">Download</a>
</body>
</html>
A bit of a nasty solution is to set
target='_blank'on the link tag. This opens the request in a separate window but once the request has been registered as a download the window will close and leave the user on the original page with the new download in the background.This seems to work well on Chrome and Firefox but Safari leaves the new window whilst the download is going.
Another solution is to reload the iframe setting setting its
srcattribute to itself. The only trouble with this is that the user will lose their scroll position.I opted for a hybrid solution but did make the massive assumption that all versions of Chrome and Firefox exhibit the same behaviour (closing the tab when the download starts). That’s probably incorrect so the browser detection should probably be refined.
Or, hey, Google could fix Google docs 🙂