This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes IMG not displayed when inside server (tomcat) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "IMG not displayed when inside server (tomcat)" Watch "IMG not displayed when inside server (tomcat)" New topic
Author

IMG not displayed when inside server (tomcat)

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Hi,

I have a very simple page, sample.html, with nothing inside but 1 img tag



If I open this sample.html by double-clicking it in windows explorer, it opens as expected.

If it is served from the server, the image is not displayed.

Any thoughts?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41629
    
  55
Why would a page served from a server include an image tag that references an image that's on the client? This page would only work on your machine, not anywhere else.


Ping & DNS - my free Android networking tools app
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Originally posted by Ulf Dittmer:
Why would a page served from a server include an image tag that references an image that's on the client? This page would only work on your machine, not anywhere else.


Sorry I just realized that; i asked the wrong question.

Actually, my problem is:

I have an empty table TD tag, with id, like below:



Now, I use javascript .innerHtml to put an IMG tag inside it, as below:



The image is not displayed.

(I checked by checking the value of the imageHolder and I get the correct data "<img src='C:/image/A.jpg'>", but there is no image displayed.)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41629
    
  55
I've never tried that (as I said, I don't think it makes much sense), but it could be a security restriction that pages from a server are not allowed to reference local files.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
The page is already served at the client when I triggered the change for IMG tag.

The image exists in the client PC.

I also am looking at the possibility that it is related to security.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Most modern day browsers do not let you link to local files.

Eric
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Originally posted by Eric Pascarello:
Most modern day browsers do not let you link to local files.

Eric


If say I will allow even there is security hole on the resolution, is there any such way, so that I can do so and have my image displayed?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IMG not displayed when inside server (tomcat)