My problem is maybe specific and not a duplicate of this question.
I'm trying to load a HTML file and a script from Copy (which is a Dropbox-like) but since Copy declares those files with mime-type text/plain
with a header X-Content-Type-Options: nosniff
I get the error within Chrome strict MIME type checking is enabled
.
I decided to load the content within a script tag. This is my attempt:
z = new XMLHttpRequest(); /* this is for the script.js file which is actually
jquery.min.js with bootstrap.min.js */
z.onreadystatechange = function () {
if (z.readyState == 4) {
if (z.status == 200) {
x = new XMLHttpRequest(); /* this is for the HTML file */
x.onreadystatechange = function () {
if (x.readyState == 4) {
if (x.status == 200) {
document.write(x.responseText.replace("\x3Cscript type=\"text/javascript\" src=\"xfiles/sys/script.js\">\x3C/script>", "\x3Cscript type=\"text/javascript\">" + z.responseText + "\x3C/script>").replace("<head>", "<head><base href='http://copy.com/N9NLnrlQvzer/residanat/'/>"));
}
}
};
x.open("GET", "http://copy.com/N9NLnrlQvzer/residanat/index.html", true);
x.send(null);
}
}
};
z.open("GET", "http://copy.com/N9NLnrlQvzer/residanat/xfiles/sys/script.js", true);
z.send(null);
The content is actually loading but I get a funny result.
Any clues about what went wrong?
Thanks!