diff options
author | alexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none> | 2010-02-03 00:46:50 +0000 |
---|---|---|
committer | alexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none> | 2010-02-03 00:46:50 +0000 |
commit | 4a9748e10084ca99fadec4f0fb1a3c22af7f3794 (patch) | |
tree | ee6c41a5458e75a253890856f4d096d387c14f93 /trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html | |
parent | cf537a08aa75b85a9ac66b61573ccab981542e10 (diff) | |
download | etherpad-4a9748e10084ca99fadec4f0fb1a3c22af7f3794.tar.gz etherpad-4a9748e10084ca99fadec4f0fb1a3c22af7f3794.tar.xz etherpad-4a9748e10084ca99fadec4f0fb1a3c22af7f3794.zip |
initial code push
--HG--
extra : convert_revision : svn%3Ab2ef00c0-3703-41da-baef-cfe82387ac0c/trunk%403
Diffstat (limited to 'trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html')
-rw-r--r-- | trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html b/trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html new file mode 100644 index 0000000..3bdb5c4 --- /dev/null +++ b/trunk/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html @@ -0,0 +1,76 @@ +<html> +<head> +<script> +function createRequestObject() { + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') { + try { + xmlhttp = new XMLHttpRequest(); + } catch (e) { + xmlhttp=false; + } + } + if (!xmlhttp && window.createRequest) { + try { + xmlhttp = window.createRequest(); + } catch (e) { + xmlhttp=false; + } + } + return xmlhttp +} +var host = window.location.host; +var oldDomain = document.domain; +var newDomain = oldDomain.substring(oldDomain.indexOf(".", oldDomain.indexOf(".")+1)+1); + +function doAction(method, uri, async, headers, body, cb) { + try { + document.domain = oldDomain; + } catch (e) { } + var req = createRequestObject(); + req.open(method, '//'+host+uri, async); + for (var i in headers) { + req.setRequestHeader(i, headers[i]); + } + req.onreadystatechange = function() { + if (req.readyState == 4) { + try { + document.domain = newDomain; + cb(req.status, req.responseText); + } catch (e) { + // yikes. well, hopefully a timeout will notice this error. + } + } + } + req.send(body); +} +function doAbort(xhr) { + try { + document.domain = oldDomain; + } catch (e) { } + xhr.abort(); +} +document.domain = newDomain; +window.onload = function() { + var doneKey = 'done_'+oldDomain.split(".", 2)[0]; + setTimeout(function() { + window.parent[doneKey](); + }, 0); +} +</script> +</head> +<body> +</body> +</html> |