diff options
author | Sam Potts <me@sampotts.me> | 2016-01-16 13:02:04 +1100 |
---|---|---|
committer | Sam Potts <me@sampotts.me> | 2016-01-16 13:02:04 +1100 |
commit | 891abd1d4a4071f64c330cb0bb781955335acb01 (patch) | |
tree | 9e5e5509611dac11d9a48cdf0dfbcdf9b66a018c /docs/index.html | |
parent | aed7db34ea3a3224897e388286228569e0b2a182 (diff) | |
download | plyr-891abd1d4a4071f64c330cb0bb781955335acb01.tar.lz plyr-891abd1d4a4071f64c330cb0bb781955335acb01.tar.xz plyr-891abd1d4a4071f64c330cb0bb781955335acb01.zip |
Final tweaks for v1.5 and IE9
Diffstat (limited to 'docs/index.html')
-rw-r--r-- | docs/index.html | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/docs/index.html b/docs/index.html index ad3d9d01..eee24458 100644 --- a/docs/index.html +++ b/docs/index.html @@ -83,17 +83,34 @@ 'dist/docs.svg' ] .forEach(function(u) { - var x = new XMLHttpRequest(), b = document.body; + var x = new XMLHttpRequest(), + b = document.body; + // Check for CORS support // If you're loading from same domain, you can remove the whole if/else statement - // XHR for Chrome/Firefox/Opera/Safari - if ('withCredentials' in x) { x.open('GET', u, true); } - // XDomainRequest for older IE - else if (typeof XDomainRequest != 'undefined') { x = new XDomainRequest(); x.open('GET', u); } + // XHR for Chrome/Firefox/Opera/Safari/IE10+ + if ('withCredentials' in x) { + x.open('GET', u, true); + } + // XDomainRequest for IE8 & IE9 + else if (typeof XDomainRequest == 'function') { + x = new XDomainRequest(); + x.open('GET', u); + } else { return; } - x.send(); - x.onload = function() { var c = document.createElement('div'); c.setAttribute('hidden', ''); c.innerHTML = x.responseText; b.insertBefore(c, b.childNodes[0]); } + // Inject hidden div with sprite on load + x.onload = function() { + var c = document.createElement('div'); + c.setAttribute('hidden', ''); + c.innerHTML = x.responseText; + b.insertBefore(c, b.childNodes[0]); + } + + // Timeout for IE9 + setTimeout(function () { + x.send(); + }, 0); }); })(); </script> |