JPG disappeared when I cleared Cache

Hey There!

So Iwas having a problem updating the paragraph font using my CSS and it was suggested that I clear the cache on my browser. I cleared it and the font was updated but, in the process, the jpg that was on the homepage was lost.

I tried to open my site using safari and firefox. The only difference between the two browsers is that when I open the page on safari, the jgp shows up as a white box with a question mark in the center wheras in safari it doesn’t show up at all…

Any thoughts or suggestions??? :eye:

post your website url…

It sounds like you have a faulty link to the image file and I suspect you meant in Fx you saw nothing and in Safari it was a question mark. Because your sentence said you saw two totally ‘different’ results for one browser.

I changed nothing in the link… the jpg appeared perfectly fine before i cleared the cache. after it wouldn’t show up at all so I don’t think that it has to do with the link. Look:

<p><img src=“divers-circle.jpg” width=“200” height=“162”
alt=“A circle of divers practice their skills”/></p>

The caption shows up but not the jpg. Again, I changed nothing about the above markup, just cleared cache and the photo disappeared… and you’re right about safari vs. fx and the images… sorry for the confusion :slight_smile:

Any suggestions now?

ps… i’m working out of the book Build Your Own Website The Right Way Using HTML & CSS (2nd Edition)

Try doing this:

It sounds like what you are describing is that you had the image there at one point. It got stored in your cache and something happened to the image, so when it tried to find it, it wasn’t there any more.

If you haven’t moved the image, did you remove/change a <base> element? Also, are you working locally or remotely? If you are working remotely, it might benefit you to just go ahead and upload the image to that place again and see if it works.

It would have helped if you had told use you were a ‘newbie’ and working from Ian’s book within the first post. Though now you have it makes it slightly easier. That small sample of code looks correct and seems to match the book.

What page have you got to at the moment?

Are you working online or offline? Because like was mentioned when a browser enters offline mode it can retain cached pages and images until you hard reload/refresh the browser sometimes.

The results you are describing are most likely with regards to a faulty image path. So if it was working before and there have been zero code changes. Then the images has somehow been moved or renamed at some point. That is assuming you haven’t made any typos in between with the XHTML or CSS, etc.

The ‘divers-circle.jpg’ should be in the exact same folder as your current webpage (index.html), double check that that the *.JPG file resides there.

If you are still having these issues after checking the paths and typos post us a sample of the page code as there might be something else wrong effecting things.

well right now i’m on page 143 but the problem arose when i was on page 85 when i was instructed to clear the cache.

i think that i’m working offline. i’m doing exactly what the book says to do. i downloaded Text Wrangler and i’m using that program for my css and html pages. When I open the site that i’m building in safari/firefox it looks exactly as it should, other than the fact that the jpg isn’t coming out correctly. I’m working with Mac OS, in “Finder” I created a separate folder for “Sites” in FInder as the book instructed and all of my files are in there for this project, including the jpg.

The page code is as follows:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Bubble Under-The diving club for the south-west UK</title>
        <meta http-equiv=Content-Type"
            content="text/html; charset=utf-8"/>
        <link href="style1.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
      <div id="header">
       <div id="sitebranding">
        <h1>BubbleUnder.com</h1>
      </div>
      <div id="tagline">
        <p>Diving club for the south-west UK-let's make a splash!</p>
    </div> <!-- end of header div -->
    <div id="navigation">
     <ul>
         <li><a href="index1.html">Home</a></li>
         <li><a href="about.html">About Us</a></li>
         <li><a href="contact.html">Contact Us</a></li>
     <ul>
    </div> <!-- end of navigation div -->
    <div id="bodycontent">
        <h2>Welcome to our super-duper Scuba site</h2>
        <p>[B]<img src="divers-circle.jpg" width="200" height="162"
            alt="A circle of divers practice their skills"/>[/B]</p>
        <p>Glad you could drop in and share some air with us! You've passed
           you're underwater navigation skills and successfully found your
           way to the start point - or in this case, our home page.</p>
        </div> <!-- end of bodycontent div -->
    </body>
</html>

Thank you so much for taking the time to help me… and I’m sorry that I didn’t tell you that I’m a newbie :smiley:

Some of the special Mentors (like myself) have been given this book; so that we can quickly detect what you are supposed to be doing. A lot of the Mentors and other members don’t have the book so don’t release when somebody posts here they are following book material.

Yes, it talks about saving your file(s) first before reloading the browser; it is a common mistake that People forget to save their CSS and XHTML before viewing it in the browser. Then they wonder why their changes aren’t showing/updated. That’s because they are seeing the previously saved file - not the one the are still editing and haven’t saved.

You have several typos within that code but nothing that would prevent the image loading. I’ll assume your CSS ‘style1.css’ file is working. Since you said, you saw a question mark - possibly being a broken image.

Below is your corrected markup:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
      Bubble Under-The diving club for the south-west UK
    </title>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=utf-8" />
    <link href="style1.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <div id="header">
      <div id="sitebranding">
        <h1>
          BubbleUnder.com
        </h1>
      </div>
      <div id="tagline">
        <p>
          Diving club for the south-west UK-let's make a splash!
        </p>
      </div>
    </div><!-- end of header div -->
    <div id="navigation">
      <ul>
        <li>
          <a href="index1.html">Home</a>
        </li>
        <li>
          <a href="about.html">About Us</a>
        </li>
        <li>
          <a href="contact.html">Contact Us</a>
        </li>
      </ul>
    </div><!-- end of navigation div -->
    <div id="bodycontent">
      <h2>
        Welcome to our super-duper Scuba site
      </h2>
      <p>
        <img src="divers-circle.jpg" width="200" height="162"
        alt="A circle of divers practice their skills" />
      </p>
      <p>
        Glad you could drop in and share some air with us! You've
        passed you're underwater navigation skills and
        successfully found your way to the start point - or in
        this case, our home page.
      </p>
    </div><!-- end of bodycontent div -->
  </body>
</html>

Since you aren’t seeing the image and that code looks reasonable it basically means the: divers-circle.jpg isn’t where it is supposed to be or it has been renamed.

It must be in the same directory as: index.html

I assume you have also used the browser to directly open the image itself to double-check you have the correct path and that it displays.

Therefore like all great coders the thing to do is double check things. :wink:

Then create a very simple page for example copy-and-paste the following and call it ‘test.htm’ and place it in the same directory as your; 'index.html’ which should also contain the *.jpg file.

Filename: test.htm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=UTF-8" />
    <title>
      Image test
    </title>
<style type="text/css">
/*<![CDATA[*/
<!-- 
img { border: thick solid red; } 
/*]]>*/
</style>
  </head>
  <body>
    <div>
      <img src="divers-circle.jpg" width="200" height="162" alt=
      "A circle of divers practice their skills" />
      <p>
        "You hear a slurping sound"
      </p>
    </div>
  </body>
</html>

If your image doesn’t load for this test.htm file then we can be certain the file is not where it should be and so forth.

Even if the image is actually missing (in my test.htm file) you should still see the red border and alt attribute text in Firefox. So try placing my ‘test.htm’ file in the same directory and opening it first.

Because it is a very common mistake misplacing things. :slight_smile:

ok so i took the lazy way out and i copied and pasted your corrected markup in my index.html file and replaced my markup and the jpg showed up… were my typos just in the form? because i’m following it very closely to the book. i noticed that you spaced the elements way differently than i did… i wonder if that had something to do with it…

thanks a ton, you’re the ****.

-Lyndsay

No worries. What you posted here originally and post #8 would have worked fine even though it had errors in #8. So I don’t know what else must have happened in-between?

Anyway it seems fine now which is good. If you want to look for the errors you had you could visit: The W3C Markup Validation Service it talks about it in the book somewhere but I don’t have the book close at hand at the moment.

thanks again so much for the help… i’m sure as i make my way through the book i’ll be posting more issues… i hope you can help me!

wait wait wait… when i try to open it in firefox it’s not working… but in safari it does… waaaaaaaaaa!!!

omg i’m such a spaz… and also the font color of my h2 heading isn’t showing up at all now… here’s the markup for my css:

/*
CSS for Bubble Under site
*/
body {
font-family: Verdana, Helvetica, Arial, sans-serif;
background-color: #e2edff;
line-height: 125%;
padding: 15px;
border: 4px solid navy;
}

h1, h2, h3 {
font-family: “Trebuchet MS”, Helvetica, Arial, sans-serif;
}

h1 {
font-size: x-large;
background-color: navy;
color: white;
}

h2 {
color: navy;
font-size: 130%;
font-weight: normal;
}

li {
font-size: small;
}

p {
font-size: small;
color: navy;
}

#tagline p {
font-style: italic;
font-family: Georgia, Times, serif;
background-color: #bed8f3;
border-top: 3px solid #7da5d8;
border-bottom: 3px solid #7da5d8;
}

em {
text-transform: uppercase;
}

a {
font-weight: bold;
}

a:link {
color: black;
}

a:visited {
color: navy;
}

a:hover {
text-decoration: none;
color: white;
background-color: navy;
}

a:active {
color: aqua;
background-color: navy;
}

.fun {
color: #339999;
font-family: Georgia, Times, serif;
letter-spacing: 0.05em;
}

blockquote.fun {
font-style: italic;
}

#navigation {
width: 180px;
border: 1px dotted navy;
background-color: #7da5d8;
}

i can’t find anything wrong with it…

SO weird… now everything is totally fine in firefox other than the fact that the jpg won’t show up… but in safari the jpg shows up but other changes aren’t being made… i don’t get it.

The CSS was fine. Make sure your refresh/reload the browser each time AFTER SAVING the files you are working on or it won’t change. Make sure you are editing the correct files in the right place.

The Firefox issue doesn’t make any sense I assume you can see other images within webpages for Firefox when you use it? Try loading a different named image in Fx using my test.htm just changing the SRC value for the new/different JPG image name and see if it loads. Obviously save first, next press ‘Reload’ (maybe better do a hard Fx reload) then view.

ok so when i open your test code, in safari i am able to see the image surrounded by a red border but when i open it in fx, it just says “A circle of divers practice their skills” inside of a red border. On safari, there is no caption at all. OH CRAP!!! When i went to do a hard reload in safari the jpg disappeared! In fx nothing changes when i do a hard reload.

Just to be sure that all of the files are where they are supposed to be, i created a new folder within my “sites” place and saved the jpg and the markup files (about.html, contact.html & index.html) there. I even tried to use a different jpg and the same thing happened as i just expressed…

also, just to let you know, i ALWAYS save after i make changes on the markup pages and i always reload too… :smiley: i’m a good little newbie…

ok so i fixed it… i reset the cache settings in firefox and it seems to be all good now… but who knows, tomorrow i’ll probably have another help topic for you :wink:

thanks a ton.

-Lyndsay

No worries it seems like for some reason your cache settings were not plumb. Perhaps you could do a clean install of Firefox it if goes like that again. I was even considering asking if you had images turned-off a blocking software or Addons that could be causing a conflict. A good addon to have for firefox is: Web Developer Addon. It can help detect if images are missing and allow you to have more control of things while making web pages.

well i just downloaded firefox specifically for this project. i went into the settings and made it so that the cache would clear each time i close firefox and that seemed to do the trick. weird. thanks again!