diff options
author | Elliot Kroo <kroo@appjet.com> | 2010-03-11 15:21:30 -0800 |
---|---|---|
committer | Elliot Kroo <kroo@appjet.com> | 2010-03-11 15:21:30 -0800 |
commit | 98e2821b38a775737e42a2479a6bc65107210859 (patch) | |
tree | 55939a8ba1dce4f4e48ebb13b658061d62bf1b9a /infrastructure/net.appjet.ajstdlib/streaming-iframe.html | |
parent | c1894c8e0a52f4e3d2f89fa92f0066bbf0fcf1b1 (diff) | |
download | etherpad-98e2821b38a775737e42a2479a6bc65107210859.tar.gz etherpad-98e2821b38a775737e42a2479a6bc65107210859.tar.xz etherpad-98e2821b38a775737e42a2479a6bc65107210859.zip |
reorganizing the first level of folders (trunk/branch folders are not the git way :)
Diffstat (limited to 'infrastructure/net.appjet.ajstdlib/streaming-iframe.html')
-rw-r--r-- | infrastructure/net.appjet.ajstdlib/streaming-iframe.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/infrastructure/net.appjet.ajstdlib/streaming-iframe.html b/infrastructure/net.appjet.ajstdlib/streaming-iframe.html new file mode 100644 index 0000000..3bdb5c4 --- /dev/null +++ b/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> |