Closed Bug 322147 Opened 20 years ago Closed 20 years ago

xmlhttp request returns xhtml with an img tag but does not display the image,

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bdn_01, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.12) Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.12) Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7) A xmlhttp response returns the following xhtml elements (which are then appended to the body of a page) but fails to display the image. A http trace shows a request for the xmlhttp request but no request for the image, as such the alt text is displayed. I have not had this issue under windows IE. <div xmlns=\"http://www.w3.org/1999/xhtml\"><img id=\"test\" src=\"../themes/default/blockImageHead.png\" alt=\"test\" /></div> Right clicking the alt text and clicking "view image" then displays the image correctly in a separate window. Reproducible: Always Steps to Reproduce: 1. Create a javascript xmlhttp (see below) that calls a url that returns some the xhtml: <div xmlns=\"http://www.w3.org/1999/xhtml\"><img id=\"test\" src=\"../themes/default/blockImageHead.png\" alt=\"test\" /></div> -- Replace the image with an image you have access to -- 2. Create a page that launches the javascript and appends the xhtml to the page. Javascript function: var xmlhttp=false; var url='http://localhost:8080/ws/home'; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", url, false); xmlhttp.send(null); if (xmlhttp.status != 200) { alert (xmlhttp.responseText); } else { ws = document.getElementById('workspace'); // this is the body if (browser.isIE) { ws.appendChild(xmlhttp.responseText); } else if (browser.isNS) { ws.appendChild(xmlhttp.responseXML.childNodes.item(0)); } Actual Results: See details Expected Results: Image should be displayed. I've tried pre-loading but this does not help: // var images = xmlhttp.responseXML.getElementsByTagName("img"); // if (images.length != 0) { // var preLoad = new Array(images.length); // for (var i = 0; i < images.length; i++) { // var img = images[i]; // if (img != null) { // preLoad[i] = new Image(); // preLoad[i].src = img.src; // } // } // delay(100); // }
This could be an issue related to base URIs. Have you tried using an aboslute URL for the image?
(In reply to comment #1) > This could be an issue related to base URIs. Have you tried using an aboslute > URL for the image? > Hi Jesse, Yes. I have tried a combination of addresses all of which resolve if directly typed into the browser toolbar. I considered the same possibility and tried the absolute url: "http://localhost:8080/ws/home/imagetest.png". This made no difference. In addition I have taken the dynamic xhtml returned by the server and created a static web page from it and then all images resolve ok. Regards Brendan
WFM with http://www.squarefree.com/bug322147/grab.html and Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20060103 Firefox/1.6a1. Does http://www.squarefree.com/bug322147/grab.html work for you? If not, what are you doing differently?
(In reply to comment #3) > WFM with http://www.squarefree.com/bug322147/grab.html and Mozilla/5.0 > (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20060103 > Firefox/1.6a1. > > Does http://www.squarefree.com/bug322147/grab.html work for you? If not, what > are you doing differently? > Hi Jesse, No. This doesn't work, unless I right-click and select view image. Regards Brendan
You're using a very old version of Firefox. Can you upgrade to Firefox 1.5 (at least) and say whether you still see the bug?
(In reply to comment #5) > You're using a very old version of Firefox. Can you upgrade to Firefox 1.5 (at > least) and say whether you still see the bug? > Hi Jesse, I have upgraded as you have recommended and now "http://www.squarefree.com/bug322147/grab.html" works ok. This has resolved this bug as well. I also note that drag n drop is much smoother too. Excellent. Thank you Brendan
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.