A misunderstanding on my part: the iframe is between noscript tags, so
it's irrelevant to my problem. Instead, it turns out that when jquery
moves the div that contains the recaptcha, Safari rerenders the tags,
and reexecutes all the javascript. And somehow the document.write gets
confused about where it is and overwrites the entire page.
Anyway, the fix is really simple:
$('#captcha-form script').remove();
(where 'captcha-form' is the id of the form containing the captcha).
This makes sure the script tags don't get rendered twice. All the event
handlers created by the script survive this removal.
A better looking fix would be to put the recaptcha script outside the form
and let it write the captcha inside the form, but since I'm using a grails
plugin to generate all the recaptcha tags, that's less of an option for me.
mcv.