Sift Partners Network:DwiggerVaro CMSScrape UpEscalopter
Little Help: IE Displays IMG but Fire Fox Does Not: Coders
posted by NordlichReiter 1 month ago • 319 views
Its Official I have the dumb:



I just cannot figure it out, why IE Explorer shows the image fine, and Fire Fox doesn't, cross platform programming is difficult some times.

Hey, I usually wouldn't do this, but this problem has plagued me for some time, and I will explain. But first let me show you my code:

This is how it is represented in fire fox, and IE.

< span id="UploadPicture1_Label1"> img src="&92Images&92Blue hills.jpg"alt="bla" title="bla bla bla" width ="250" height = "250"/> </span>


This is the method that saves and image and then plugs it in as HTML


protected void Button1_Click(object sender, EventArgs e)
{

FileUpload1.SaveAs(Server.MapPath(@"\Images\") + FileUpload1.FileName);
string filename = FileUpload1.FileName;
imagename = filename;
Label1.Text = "<img src=" + "\""+"\\Images" + "\\"+filename + "\""+ "alt=\"bla\" title=\"bla bla bla\"" + " width =\"250\"" + " height = \"250\"/>";
Label2.Text = TextBox1.Text;
}


When the button is pressed, the label text should change to a image tag and display an image. But it works in IE, and then does not work in Fire Fox. Maybe the HTML is malformed?

I wish I could put this in the rage channel, because I am suffering from Code Rage, and I sit in a public office area... so I have to go outside to curse.

Any help would be great!

EDIT: \" or \\ these are escape from code characters.. allows the text to contain punctuation normally reserved for compiler activities.

Example:

string test = "he said\"Look at this sift talk, its complete crap\"";
Output: he said\"Look at this sift talk, its complete crap\"

string test = "he said"Look at this sift talk, its complete crap"";
OutPut: SYNTAX ERROR

EDIT: go here to learn how to denote punctuation as html code. Character Entities

bookmarks (0)
Comments subscribe to this feed
OK So the fact that Im using HTML .. and code behind is killing my code post.

But in Short I want to know why this works in IE but not Fire Fox.

I know... I want the formatting tags to work too.

The sites I have been to through google... none of them help, but they explain alot about firefox alt and Title tag.. but do nothing to help with the problem above.


written by NordlichReiter  | 1 month ago | CH
 0  | flag spam (0)
I might be too late, but can you repost your code inside <code></code> tags? Is that method javascript? Can I see more of the code, like the whole page it's on or something?


written by berticus  | 1 month ago | CH
 1  | flag spam (0)
This

< span id="UploadPicture1_Label1"> img src="&92Images&92Blue hills.jpg"alt="bla" title="bla bla bla" width ="250" height = "250"/> </span>


Is missing < before img, but is that a miss when you posted it?

Can't you use single quotations to avoid all the escapes? I always do this, because my brain don't want to escape everything.

Something like

Label1.Text = '<img src=' + '\\Images' + '\\' + filename + '"' + 'alt="bla" title="bla bla bla"' + ' width ="250"' + ' height = "250" />';

or rather it should be slashes, shouldn't it?

Label1.Text = '<img src=' + './Images' + '/' + filename + '"' + 'alt="bla" title="bla bla bla"' + ' width ="250"' + ' height = "250" />';


written by gwiz665  | 1 month ago | CH
 1  | flag spam (0)
It's C# isn't it?


written by gwiz665  | 1 month ago | CH
 1  | flag spam (0)
<em>

< span id="UploadPicture1_Label1"> img src="&92Images&92Blue hills.jpg"alt="bla" title="bla bla bla" width ="250" height = "250"/> </span>

</em>

it looks like the opening to your img tag is missing.

edit: jinx


written by dgandhi  | 1 month ago | CH
 2  | flag spam (0)
Yea, the tag was missing when I posted it with updated character entities.

I know this because the code works in IE, if it was broken it wouldn't work at all.

But, I will try the comma instead of all the escapes.

in the button method .. the tag is there.. however it could be lost in the post back, I don't know how.. but I would I expect its something like that.

But Maybe the tag ... is missing indeed, ill have to check when I'm not buzzing from Guinness.

That is c#.


written by NordlichReiter  | 1 month ago | CH
 0  | flag spam (0)
I'd suggest you start by installing the FireBug add-on for FireFox and checking its console for any errors that might be occurring.


written by lucky760  | 1 month ago | CH
 0  | flag spam (0)
I figured it out.

First I need a virtual path, second firefox does not like /images/, it likes images/.

IE lets you get away with murder as a coworker said today.

Acceptable Code:
string filename = "Images/" + FileUpload1.FileName;
Not Acceptable
string filename = "/Images/" + FileUpload1.FileName;


written by NordlichReiter  | 1 month ago | CH
 0  | flag spam (0)
Thanks all for the help, and FireBug is on the download.


written by NordlichReiter  | 1 month ago | CH
 0  | flag spam (0)
Ok, to any one who took an interest in this I have changed the way I am doing the whole Image gallery, Im using a .net table component, image component, and button components.

The only reason I didn't do this before, was caused by the Directory issue.
So I do not have to inject HTML any more!


written by NordlichReiter  | 1 month ago | CH
 0  | flag spam (0)
broken code works in IE half the time

image gallery..seeing as you mention it... i found this nice one recently, no flash or crazy stuff, javascript (if you like it like that)

http://smoothgallery.jondesign.net/showcase/gallery/
http://smoothgallery.jondesign.net/showcase/gallery-set/


written by MINK  | 1 month ago | CH
 0  | flag spam (0)
glad you got it fixed


written by berticus  | 1 month ago | CH
 0  | flag spam (0)
Ah, don't do "/images/" do "./images/"

And good you got it fixed.


written by gwiz665  | 1 month ago | CH
 0  | flag spam (0)
Submit Comment
log in or register to submit new comment


Friends O' the Sift