you could try appending some sort of query string on the end of the
image name?

http://images.earthcam.com/ec_metros/newyork/newyork/lindys.jpg?refreshImg=[random_number]";

for [random_number] try generating a random number using javascript
then putting it there. I have heard that passing a query string can
trick browsers into thinking it is a different file.

On Nov 12, 6:02 pm, Jay <jinqi...@gmail.com> wrote:
> I am trying to display a image on my website. The image always has the
> same file name, but the content will change each time it is requested.
> I use the following code to refresh it on my web site, but it only
> works with Firefox. Is there any better way to do it?
>
> <html>
>   <head>
>       <title>Simple Page</title>
>       <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8">
>       <meta http-equiv="Expires" content="-1">
>       <meta http-equiv="Pragma"  content="no-cache">
>       <meta http-equiv="Cache-Control"  content="no-store, no-cache,
> must-revalidate, max-age=0">
>
>       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
> jquery.min.js" type="text/javascript"></script>
>
>       <script type="text/javascript">
>
>           function refreshimage( ) {
>
>               $("#imgNYC").attr("src", "http://images.earthcam.com/
> ec_metros/newyork/newyork/lindys.jpg");
>               $("#imgNYC").show();
>               setTimeout(refreshimage, 500);
>           }
>
>               $(document).ready(function(){
>               $(window).load(refreshimage());
>           });
>       </script>
>   </head>
>   <body>
>   <table>
>     <tr>
>       <td><img src="http://images.earthcam.com/ec_metros/newyork/
> newyork/lindys.jpg" alt="" id="imgNYC" ></td>
>     </tr>
>   </table>
>   </body>
> </html>

Reply via email to