Need help in a conditional html test

C

Cogito

A daily graphic from another site is replicated in a page I'm building
like so:

<img src="http://www.---.com/pics/pic1.jpg">

The graphic, in the origination site changes several times a week and
always has the same file name, say, pic1.jpg. The problem is that on
certain days the graphic is not posted on the originating site at all.
This causes an ugly not found icon to show up in my page.

My question is: Is there some simple code that I can place around the
<img> tag that will test if the image is there. If there, display it
as before. If not, display a message 'image unavailable'.
 
E

Els

Cogito said:
A daily graphic from another site is replicated in a page I'm building
like so:

<img src="http://www.---.com/pics/pic1.jpg">

The graphic, in the origination site changes several times a week and
always has the same file name, say, pic1.jpg. The problem is that on
certain days the graphic is not posted on the originating site at all.
This causes an ugly not found icon to show up in my page.

No offence, but that sounds like you're hotlinking to a site that's
not yours.
My question is: Is there some simple code that I can place around the
<img> tag that will test if the image is there. If there, display it
as before. If not, display a message 'image unavailable'.

Probably serverside, but not in the HTML.
 
C

Cogito

No offence, but that sounds like you're hotlinking to a site that's
not yours.

Not quite sure what hotlinking is. Basically, I display the graphic
from the other site and a click on it will take the user to that site.
Is this considered wrong?
 
C

Cogito

No offence, but that sounds like you're hotlinking to a site that's
not yours.


I just did a Google search on hotlinking. I do understand now what it
is and why it is frowned upon. I'll change my code to not do it
anymore. Thanks you.
 
D

David Dorward

Not quite sure what hotlinking is. Basically, I display the graphic
from the other site and a click on it will take the user to that site.
Is this considered wrong?

If you don't have permission from the site? Generally yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top