The problem isn't that the Javascript is removing any headers, it's that you're trying to set the content of a div to be the binary data of an image. You can't display images by dumping the data into the middle of a page.
If you want to preload an image nicely you need to create an image in the page's image array and set it's source to be the URL of the image, that'll load it, then create an img tag in the page and set it's src to be the image that you loaded.
//Create a new image in the page
var gdImage = new Image();
//Preload an image asset into the new image
gdImage.src = 'http://www.majesticarpg.com/avatar3.php';
//Create a new img tag in the page
var newimg=document.createElement('img');
//Set the new img tag's src to be the same as the image we preloaded
newimg.src='http://www.majesticarpg.com/avatar3.php';
//Append it to the output div
var output = document.getElementById('output');
output.appendChild(newimg);
I think that's about right. It's a while since I've done any DOM scripting/AJAX stuff without jQuery. You might even be able to set the src of newimg to be gdImage.
onion2k wrote:The problem isn't that the Javascript is removing any headers, it's that you're trying to set the content of a div to be the binary data of an image. You can't display images by dumping the data into the middle of a page.
If you want to preload an image nicely you need to create an image in the page's image array and set it's source to be the URL of the image, that'll load it, then create an img tag in the page and set it's src to be the image that you loaded.
//Create a new image in the page
var gdImage = new Image();
//Preload an image asset into the new image
gdImage.src = 'http://www.majesticarpg.com/avatar3.php';
//Create a new img tag in the page
var newimg=document.createElement('img');
//Set the new img tag's src to be the same as the image we preloaded
newimg.src='http://www.majesticarpg.com/avatar3.php';
//Append it to the output div
var output = document.getElementById('output');
output.appendChild(newimg);
I think that's about right. It's a while since I've done any DOM scripting/AJAX stuff without jQuery. You might even be able to set the src of newimg to be gdImage.
sorry i am confused how this works.
i have added this to <head> now i dont get any errors and it doesnt do anything differently.
it loadeds the same image that i am guessing was cached.
is there anything else i must do?