Closed Bug 232296 Opened 21 years ago Closed 21 years ago

document.write('<img src="./blabla.gif">'); does not display image in an iframe if commanded by a button in mainframe!

Categories

(Firefox :: General, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: gerwin_kramer, Assigned: bugzilla)

References

()

Details

User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

I have a chat made with javascript and flash, but if i want to add a smilie, it
doesn't work, you can see it for your self here http://thereturnable.ciprix.net.
It goes like this, when you press on the buton or press enter, an image (the
smilie) will be written in the iframe: iframe.document.write('<img
src="./test.gif">'); but, then an image will shown that you see when the url of
an image does not exist! So you can't see your smilie in the iframe, i'd like to
find a solution but couldn't find one yet, please help, bye

Reproducible: Always
Steps to Reproduce:
1. make a iframe with a name: test and an image called test.gif
2. make a button in the mainframe
3. when you press on the button a javascript will execute:
test.document.write('<img src="test.gif">');
4. The first time you'll see an image but the next time none, check the chat on
the site :P

Actual Results:  
Can't see my image

Expected Results:  
Show my image
Sorry, but I can't find a chat on that page, only a forum.
QA Contact: bugzilla
Simon: Looks like the chat is buried a little deeper in the site:

http://thereturnable.ciprix.net/phpBB2/viewforum.php?f=6&sid=cb989d9d44807ee5e701a8bbe0601793
Marcia, I doubt that this is the chat the reporter talks about. It doesn't use
any flash. I have no problems with the chat you're mentioning and I wasn't
expecting any problems there, because a similar forum system is used on
mozillazine and problems there would be reported very quickly.
Sorry guys, but you have to login first, use my test account: 
user: gerwin 
pass: test, 
than you'll see welcome gerwin, click, and then yo'll see on top a menu with 
chat in it, click on that and voila. And i forgot to tell you that it works in 
ie6 perfect, so it must be posible in mozilla. 

(In reply to comment #0)
> User-Agent:       
> Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) 
Gecko/20031007 Firebird/0.7
> I have a chat made with javascript and flash, but if i want to add a smilie, 
it
> doesn't work, you can see it for your self here 
http://thereturnable.ciprix.net.
> It goes like this, when you press on the buton or press enter, an image (the
> smilie) will be written in the iframe: iframe.document.write('<img
> src="./test.gif">'); but, then an image will shown that you see when the url 
of
> an image does not exist! So you can't see your smilie in the iframe, i'd like 
to
> find a solution but couldn't find one yet, please help, bye
> Reproducible: Always
> Steps to Reproduce:
> 1. make a iframe with a name: test and an image called test.gif
> 2. make a button in the mainframe
> 3. when you press on the button a javascript will execute:
> test.document.write('<img src="test.gif">');
> 4. The first time you'll see an image but the next time none, check the chat 
on
> the site :P
> Actual Results:  
> Can't see my image
> Expected Results:  
> Show my image

Login with Bugzilla/Bugzilla, gerwin/test isn't working anymore
This is no bug. You'll have to call 

test.document.open("text/html", "replace");    // Open the document for writing 
test.document.write('<img.....>');             // Write your HTML 
test.document.close();                         // Close the document.

See also:
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html

You could also use:
document.getElementsByTagName("body").item(0).innerHTML="<img...>";

Marking invalid based on that.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Sorry, I misunderstood the problem. But I have done a little more investigating
and found the cause. The buf is still invalid, but the reason is different tahn
the one I've mentioned.

The document you use javascript to open the document in the iframe, the problem
is that once you do that the document no longer has a root (right click->this
frame->frame info, the url is about:blank).

The only way to include the image is by putting in the full url or possibly by
including a base href in the document you've written using document.write.

An alternative would be to use the other method by appending the information at
the bottom of the body element instead of using document.write to edit the contents.

The way to go around this is to open a normal HTML page in the iframe and using 
document.getElementsByTagName("body").item(0).innerHtml += stringToTdd; to
append text at the bottom of the page.
Verified by email by the site owner
Status: RESOLVED → VERIFIED
QA Contact: bugzilla → general
You need to log in before you can comment on or make changes to this bug.