Alexander, have you tried setting headers to encourage caching (in the XHR call as well as the server output)?

Also, related to document-write, one thing about script tag insertion is you can insert the script in the head or the body. Who knows if some browsers handle those differently.