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>