开发者

Image will show in Firefox, but not in chrome

I'm having a problem where tags are being misinterpreted in chrome but not in Firefox. I have a cgi script which generates an image and a link to the image.

CGI script

if (-e $FILENAME)
{
print qq#<a href="http://blah.com/downloadfile.cgi?ID=$FILENAME"><b>Image:</b></a> #;
print qq#<img src="http://blah.com/viewimage.cgi?ID=$FILENAME"> </img>#;                      
}

Firefox Interpretation

<a href="http://blah.com/downloadfile.cgi?ID=/temp_webfiles/af08e6f3291a912cf8031984acc7942a.jpg"><b>Image:</b></a> <img 开发者_StackOverflowsrc="http://blah.com/viewimage.cgi?ID=/temp_webfiles/af08e6f3291a912cf8031984acc7942a.jpg">

Chrome Interpretation

<a href="http://blah.com/downloadfile.cgi?ID=/temp_webfiles/5eb1834ce2ea527df6c341a915b5a6fb.jpg"><b>Image:</b><img src="http://blah.com/viewimage.cgi?ID=/temp_webfiles/5eb1834ce2ea527df6c341a915b5a6fb.jpg"></a>

Just a note, the image names will be different for the chrome and Firefox, there just randomly created.

As you can see, for both the ending image tag don't show up and for chrome the tag is misinterpreted.

Is there any reasons why this happens? any suggestions?

Thanks,


Close your <img> tags properly with />:

<img src=... />


You seem to be missing a closing quote on your img src, and you are not closing your image tag correctly. This line:

print qq#<img src="http://blah.com/viewimage.cgi?ID=$FILENAME</img>#

Should be:

print qq#<img src="http://blah.com/viewimage.cgi?ID=$FILENAME" />#


You're not closing your image tag in the perl code. You've got <img src="http://blah.com/viewimage.cgi?ID=$FILENAME</img>; You don't need a closing tag (instead a self closing tag), just do <img src="http://blah.com/viewimagine.cgi?ID=$FILENAME" />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜