473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Trying to Display Image in an iFrame

Hello All,

I am trying to obtain an image asynchronously for this I have written code
which uses XMLHTTP object to retreive the image.

now I have to display this image in an iframe. when I say

iframe.contentWindow.document.write(xmlHttp.respon seText);

I get an text as "JFIF" in my frame.

Why am I not able to see the image ?

I cannot do something like <img src="img.aspx" /> because I want to fetch
the image asynchronously. using the img tag would mean that I fetch the
image in the same thread as the main page.

regards,
Abhishek.
Jun 13 '06 #1
2 2861
> Hello All,

I am trying to obtain an image asynchronously for this I have written code
which uses XMLHTTP object to retreive the image.

now I have to display this image in an iframe. when I say

iframe.contentWindow.document.write(xmlHttp.respon seText);

I get an text as "JFIF" in my frame.

Why am I not able to see the image ?

I cannot do something like <img src="img.aspx" /> because I want to fetch the
image asynchronously. using the img tag would mean that I fetch the image in
the same thread as the main page.

regards,
Abhishek.


Are you sure? IIRC first the browser needs to decode the html to find
the <img> tag. The browser will then issue a seperate request to fetch
that image.
And an image is not "text", so that may be why "responseText" gives
wrong results.

Hans Kesting
Jun 13 '06 #2
> The browser will then issue a seperate request to fetch that image.

It is a separate request. But it is on the same thread. In my application,
first the browser submits the request for form processing when that
completes, it is downloading the image.
And an image is not "text", so that may be why "responseText" gives
So how can I extract the binary data out of HTTPRequest. Sorry but I am not
very well versed with JavaScript programming.

regards,
Abhishek.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:mn***********************@spamgourmet.com...
Hello All,

I am trying to obtain an image asynchronously for this I have written
code which uses XMLHTTP object to retreive the image.

now I have to display this image in an iframe. when I say

iframe.contentWindow.document.write(xmlHttp.respon seText);

I get an text as "JFIF" in my frame.

Why am I not able to see the image ?

I cannot do something like <img src="img.aspx" /> because I want to fetch
the image asynchronously. using the img tag would mean that I fetch the
image in the same thread as the main page.

regards,
Abhishek.


Are you sure? IIRC first the browser needs to decode the html to find the
<img> tag. The browser will then issue a seperate request to fetch that
image.
And an image is not "text", so that may be why "responseText" gives wrong
results.


Hans Kesting

Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Victor | last post by:
Hi I need to open an html file from the file system and embed that html file within my main aspx form. I have 2 questions: 1) How do I open the html file? I tried the File.open(Path, mode) didnt...
6
by: Dan V. | last post by:
What is the best/simplest way to have a large top image with let's say 14 thumbnails under it in 7 rows and to replace the top image with the larger one when a user clicks on a thumbnail? I would...
7
by: Oleg | last post by:
I have a web form let's say 'YYZ.aspx'. It has an iframe in it. When it loads it shows progress bar in IE this way: loading for page then again loading for page in iframe. This part is fine....
3
by: Senthil | last post by:
Hi all I'm new in ajax. How to upload a image using ajax..
5
by: pbd22 | last post by:
Hi. I am trying to poll a long-running process via a hidden IFrame. I am noticing that the online errata gives advice for handling a server response: window.parent.handleServerResponse(); ...
1
by: spallared | last post by:
Hi, i've an IMG inside a DIV that should contains an image dynamically generated by a servlet as result of a form's action (image is sent to the browser as mime type image/png). I can't figure...
6
by: deknoopjes | last post by:
I want to display a specific area of an external website using iFrames. A year ago I created such code successfully, but lost this code due to a crashed computer. Googling for any solutions did not...
3
XtinaS
by: XtinaS | last post by:
I'm trying to write a script for Greasemonkey that will, in LiveJournal, replace a placeholdered embedded YouTube thing with a link to the video. In LiveJournal, you can set an option to have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.